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.

相关文章

  1. MySQL 图形工具 —- MySQL-Front
  2. PhpMyAdmin 错误 “Cannot load mysql extension. Please check your PHP configuration”
  3. Ubuntu Server apt-get install Apache2 & PHP5 & MySQL5
  4. MySQL 图形工具 —- HeidiSQL
  5. php代码出现错误分析详解

标签: ,

Leave a Reply

*
请输入图片中的字符以验证你并非垃圾机器人. 点击图片收听验证码的语音版.
点击这里收听此验证码的语音版本


关于站长

姚迎迎,生于 1985年3月2日, 江苏大丰人士 。修行于福州大学软件学院

Google AD

最近文章

标签云

ajax Apache apt-get CSS Debian dedecms error firefox HeidiSQL htaccess html IE6 javascript jQuery lamp linux mod_rewrite mysql mysql5 MySQL Front php phplist phpmyadmin postfix thinkphp Ubuntu ubuntu server wordpress 京腔 代码 十年 年轻的时候很傻很天真 悉尼歌剧院 数据库 新贵妃醉酒 李玉刚 歌词 歌词翻译 盛世霓裳 示例 翻译 芳华绝代 视频 贵妃醉酒 音乐

Google 广告