linux下如何修改Mysql的root密码
来源:互联网 发布:淘宝金币不够用怎么办 编辑:程序博客网 时间:2024/06/10 02:02
转载自http://blog.sina.com.cn/s/blog_538f130c01016svy.html
略有修改,把其精简了一下。
忘了mysql下的root密码,重置:
先关闭mysql:
root@ubuntu:/usr/local/mysql# ./support-files/mysql.server stop
Shutting down MySQL
.... *
跳过授权表启动mysql,关闭网络监听,让其后台运行或者开个新终端。
root@ubuntu:/usr/local/mysql#mysqld_safe --skip-grant-tables --skip-networking
Starting mysqld daemon with databases from /var/lib/mysql
提示:此时按下CTRL-Z
[1]+ Stopped mysqld_safe --skip-grant-tables --skip-networking
root@ubuntu:/usr/local/mysql#bg
[1]+ mysqld_safe --skip-grant-tables --skip-networking &
3、链接mysql服务器。
root@ubuntu:/usr/local/mysql# ./bin/mysql //具体自己安装mysql地址,下面出现的不同版本有差异
Your MySQL connection id is 9
Server version: 5.6.19 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
4、使用mysql数据库。
mysql>use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql>
5、设置root新密码。
mysql>update user set password=password('123') where user='root';
Query OK, 3 rows affected (0.01 sec)
Rows matched: 3 Changed: 3 Warnings: 0
6、退出mysql。
mysql>quit
bye
7、重起mysql。 //不同版本有区别
root@ubuntu:/usr/local/mysql#./support-files/mysql.servermysqld restart
STOPPING server from pid file /var/run/mysqld/mysqld.pid
120928 11:38:28 mysqld ended
Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]
[1]+ Done mysqld_safe --skip-grant-tables --skip-networking
现在你可以使用新的密码登录mysql了。
- linux下如何修改Mysql的root密码
- linux下如何修改Mysql的root密码
- linux下修改MySQL的root密码
- linux下修改mysql的root密码
- linux下修改mysql的root密码
- Linux下修改mysql的root密码(忘记密码)
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Android开发者必知的5个开源库
- 关于oracle pl/sql工具加锁的解决
- python实现Excel转json
- jar包调用jar包内部和外部的配置文件
- 记录日志配置文档
- linux下如何修改Mysql的root密码
- x264 - x264_slicetype_frame_cost
- 对C++沉思录中代理类实现的质疑和修改
- ATCA构架
- ios基础-分辨率适配
- Ubuntu无法用putty登录
- 内核对象
- 修改后的小米文件管理器(去掉远程管理)
- Mysql的count函数