XAMPP修改mysql的默认密码的三种方法

* How I can set a "root" password in MySQL? (method 1)

In the \xampp\mysql\bin directory enter into the console:
mysqladmin -u root password secret
Ok, "secret" should be your secret password. Then update the password for PHPMyAdmin. Open the "config.inc.php" in \xampp\phpmyadmin an edit following lines:

INSTEAD OF ...

$cfg['Servers'][$i]['user']          = 'root';
$cfg['Servers'][$i]['password']      = '';
NOW ...
$cfg['Servers'][$i]['user']          = 'root';
$cfg['Servers'][$i]['password']      = 'secret';

Set a new 'root' passwort with mysqladmin

* How I can set a "root" password in MySQL? (method 2 )

Well, there is still another possibility to set the root password. Start PHPMyAdmin with http://127.0.0.1/phpmyadmin, open the database "mysql" (never delete this!) and use the table "user". Create here a new user or e.g. simply change the password of "root." MySQL restart! After that, do not forget to change the password in the "xampp/phpmyadmin/config.inc.php" for PHPMyAdmin.

* How I can set a "root" password in MySQL? (method 3 )

This method based on a suggestion by Ruedi from Basel. With that: Thanks and Grüssli to Switzerland!

Tip: Resetting the password can be make also with the /xampp/mysql/resetroot.bat. After that, the password is empty means "".  

Step 1: Run cmd
C:\ program files \apachefriends\xampp\mysql\bin>mysqld-nt --skip-grant-tables 

Step 2: Run cmd
C:\>C:\ program files\apachefriends\xampp\mysql\bin\mysqladmin -u root flush-privileges password "newpwd" 

Step 3: Stopping MySQL
C:\>C:\ program files\apachefriends\xampp\mysql\bin\mysqladmin -u root -p shutdown
Enter password: ****** (newpwd) 

Step 4: Edit the “config.inc.php” for the access of PHPMyAdmin
C:\ program files\apachefriends\xampp\phpmyadmin\config.inc.php
Here search for "root"
'$cfg['Servers'][$i]['password'] = 'newpwd'; // MySQL password 

Step 5: MySQL restart


转载:http://www.apachefriends.org/zh_cn/faq-xampp-windows.html#password0

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值