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

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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值