How to reset the mySQL admin password
星期二, 03. 3. 2009 – Category: Linux-Server, 代码人生
怎么重置MYSQL 的管理员密码
在linux 环境下,重置root 密码主要通过以下几个方面:
How to reset the mySQL admin password
In a Unix environment, the procedure for resetting the root password is as follows:
1. Log on to your system as either the Unix root user or as the same user that the mysqld server runs as.
2. Locate the .pid file that contains the server’s process ID. The exact location and name of this file depend on your distribution, hostname, and configuration. Common locations are /var/lib/mysql/, /var/run/mysqld/, and /usr/local/mysql/data/. Generally, the filename has the extension of .pid and begins with either mysqld or your system’s hostname.
You can stop the MySQL server by sending a normal kill (not kill -9) to the mysqld process, using the pathname of the .pid file in the following command:
shell> kill `cat /mysql-data-directory/host_name.pid`
Note the use of backticks rather than forward quotes with the cat command; these cause the output of cat to be substituted into the kill command.
3. Restart the MySQL server with the special –skip-grant-tables option:
shell> mysqld_safe –skip-grant-tables &
4. Set a new password for the root@localhost MySQL account:
shell> mysqladmin -u root flush-privileges password “newpwd”
Replace “newpwd” with the actual root password that you want to use.
5. You should be able to connect using the new password.
相关文章
- MySQL 图形工具 —- MySQL-Front
- PhpMyAdmin 错误 “Cannot load mysql extension. Please check your PHP configuration”
- Ubuntu Server apt-get install Apache2 & PHP5 & MySQL5
- MySQL 图形工具 —- HeidiSQL
- php代码出现错误分析详解
标签: mysql, reset password
Leave a Reply
关于站长
Google AD
最近文章
- Ubuntu 里 flash 中的汉字显示为框框
- CSS 层最小高度的全兼容写法
- Windows2k3配置PHP服务器环境
- Joomla TinyMCE 中文语言包
- JavaScript Runcode
- Lighttp Rewrite Rule For Wordpress
- IE8 里中英文字体高度不一样
- 南京夫子庙–瞻园一瞥
- 热烈庆祝本站PR荣升至5~~
- 走在乡间的小路上