app教程网 学习教程 ubuntu 忘记root密码(ubuntu root密码)

ubuntu 忘记root密码(ubuntu root密码)

Mysql 5服务器安装在ubuntu下,但是由于一些不知道的原因,安装时输入的root账号密码无论如何都无法通过数据库服务器的验证。我别无选择,只能重新设置mysql root账号的密码。我查了一下,

通过以下方式成功重置root帐户密码。mysql5服务器安装在ubuntu下。忘记了root密码怎么办?如何重置root密码?

停止mysql服务:

代码如下:

root @ web server:/home/web master # service mysql stop然后通过忽略密码验证模式重新创建一个MySQL服务:

代码如下:

root @ web server:/home/web master # mysqld-user=MySQL-skip-grant-tables-skip-networking成功启动后返回PID及其它启动信息

代码如下:

[1]3591 root @ web server:/home/web master # 1210052:59:27[注意]插件"联盟"被禁用日志顺序编号15956851210052:59:28[注]mysqld:连接就绪。版本:" 5.5.24-0ubuntu0.12.04.1 "套接字:"/var/run/mysqld/mysqld.sock "端口:0(Ubuntu)连接到关系型数据库系统库:

代码如下:

Root @ webserver:/home/webmaster # MySQL-urootMySQL directly changes the password of the root account to the new password mynewpasswd' after connecting to the relational database library;

代码如下:

Type "help" or' \h' for help, and type' \c' to clear the current input statement. mysqlupdateusersetpassword=password ('mynewpasswd'), where user=' root ' QueryOK, 3 rowsaffected(0.00 second) RowsMatched: 3 changed: 3 warnings: 0 mysqlflusivileges. Mysqlquit goodbye to stop the relational database service process (see the screen information when starting the service earlier for PID 3591): The code is as follows:

root @ web server:/home/web master # kill 3591正常启动mysql服务,用新密码成功登录mysql服务器:代码如下:

root@webserver:/home/webmaster#servicemysqlstartroot@webserver:/home/webmaster#mysql-uroot-pmynewpasswd

本文来自网络,不代表本站立场,转载请注明出处:https: