您的位置:首页 > 产品设计 > 产品经理

I have lost my MySQL root or pmauser password 如果删除MySQL的root或者pma用户

2013-04-27 22:17 507 查看


I
have lost my MySQL root or pmauser password

http://bravo.newnetenterprises.com/wordpress/faq/i-have-lost-my-mysql-root-or-pmauser-password/

No panicking!

The developers of XAMPP included a utility to ‘repair’ the MySQL installation. Its the ‘resetroot.bat’ batch file found in c:\xammp\mysql\ Note: this will even work if you got really in trouble by deleting or changing either of these accounts.

Unfortunately, that particular developer didn’t test it, so it needs one fix.


The complete Fix

- Open the file in your editor

- Find the line that begins:
mysql\bin\mysqld.exe


- Right after –no-defaults, insert –datadir=c:/xampp/mysql/data (or the full path to your MySQL data folder). Be sure to have at least one space between defaults and the –datadir= .

- Line 18 should now look like this:

mysql\bin\mysqld.exe --no-defaults --datadir=c:/xampp/mysql/data --bind-address=127.0.0.1 --bootstrap --console --skip-grant-tables --skip-innodb
--standalone <resetroot.sql  >resetroot.err 2>&1


- Save the file

- NOW – MAKE SURE THE MYSQL SERVER IS STOPPED! in the XAMPP Control Panel -

- Execute the file either by double-clicking in Windows Explorer or opening a Command window (DOS prompt) in \xampp\mysql and typing resetroot.bat and pressing Enter.

- Start the MySQL database in the XAMPP Control Panel. You should be able to access it now.

Note: If you have modified your phpMyAdmin’s config.inc.php, you will need to change the passwords for root and pmauser to ” (single quotes with no intervening space). The default config.inc.php looks like this:

/* Authentication type and info */

$cfg['Servers'][$i]['auth_type']            = 'config';

$cfg['Servers'][$i]['user']                 = 'root';

$cfg['Servers'][$i]['password']             = '';

$cfg['Servers'][$i]['AllowNoPassword']      = true;


/* Server parameters */

$cfg['Servers'][$i]['host'] = ‘localhost’;

$cfg['Servers'][$i]['connect_type'] = ‘tcp’;

$cfg['Servers'][$i]['compress'] = false;

/* Select mysqli if your server has it */

$cfg['Servers'][$i]['extension'] = ‘mysqli’;

/* User for advanced features */

$cfg['Servers'][$i]['controluser'] = ‘pma’;

$cfg['Servers'][$i]['controlpass'] = ”;

You can use the built-in XAMPP security page to set new passwords if you wish, its found at:

http://localhost/security/xamppsecurity.php

If you check the text boxes – your settings will be written to a textfile so you can recover them.


The explanation:.

MySQL contains a special database that contains the information about the state of MySQL on your server – its the ‘mysql’ database (you can look at in in phpMyAdmin, with the mySQL monitor, or a MySQL GUI tool like MySQL Workbench. This tool (resetroot.bat)
builds a temporary file that contains the SQL commands to set the root and pmauser entries in the Users table back to their defaults amd then starts the MySQL server in a condition to take exceptional commands.

Special thanks to Nobbie and Altrea of the Apache
Friends Forum

More
information on resetting the root password from dev.mysql.com
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: