Mysql修改设置root密码的命令及方法
UNIX版
1.先停掉mysql
# /etc/rc.d/init.d/mysql stop
2.以--skip-grant-table 的参数启动mysql
# mysql_safe --skip-grant-table&
3. 更改root 密碼 123456
# mysql mysql
mysql> UPDATE user SET password=password('123456') WHERE user='root';
mysql> FLUSH PRIVILEGES;
mysql> exit
4.停掉mysql再重跑
killall mysqld
#/etc/rc.d/init.d/mysqld
# mysql -u root -p
Enter password:
Windows版
首先,停止Mysql服务(net stop mysql),是必须的
shell>mysqld-nt --skip-grant
不要关闭此窗口,然后打开新的CMD窗口
shell>mysql
mysql>use mysql
mysql>update user set password=password('newpassword') where user='root';(注意不要忘了;否则不执行)
mysql>q
shell>
关闭mysqld-nt --skip-grant这个CMD窗口
启动Mysql服务即可。
关闭mysqld-nt --skip-grant窗口后,Mysql服务并没停止
杀掉进程中的mysqld-nt进程后,重启mysql即可。
1.先停掉mysql
# /etc/rc.d/init.d/mysql stop
2.以--skip-grant-table 的参数启动mysql
# mysql_safe --skip-grant-table&
3. 更改root 密碼 123456
# mysql mysql
mysql> UPDATE user SET password=password('123456') WHERE user='root';
mysql> FLUSH PRIVILEGES;
mysql> exit
4.停掉mysql再重跑
killall mysqld
#/etc/rc.d/init.d/mysqld
# mysql -u root -p
Enter password:
Windows版
首先,停止Mysql服务(net stop mysql),是必须的
shell>mysqld-nt --skip-grant
不要关闭此窗口,然后打开新的CMD窗口
shell>mysql
mysql>use mysql
mysql>update user set password=password('newpassword') where user='root';(注意不要忘了;否则不执行)
mysql>q
shell>
关闭mysqld-nt --skip-grant这个CMD窗口
启动Mysql服务即可。
关闭mysqld-nt --skip-grant窗口后,Mysql服务并没停止
杀掉进程中的mysqld-nt进程后,重启mysql即可。
http://www.gzidc.org 要空间域名的兄弟可以找我哦
浙公网安备 33010602011771号