当前位置: 首页 > 知识 >正文

ubuntu下安装了mysql 5 server忘记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#servicemysqlstart

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

相关文章:
  • 华夏恒生科技ETF(QDII)净值下跌2.36% 请保持关注_基金频道_证券之星
  • 7月12日基金净值:信澳智远三年持有期混合A最新净值0.8146,跌1.24%
  • 6月7日基金净值:天弘中证500ETF最新净值0.9683,涨0.07%
  • 易方达中证医疗ETF净值下跌1.12% 请保持关注
  • 5月19日基金净值:交银内核驱动混合最新净值0.8654,涨0.53%
  • 6月21日基金净值:华夏科创板50ETF联接A最新净值0.8197,跌3.14%
  • 6月28日基金净值:万家中证1000指数增强A最新净值1.2627,跌0.55%
  • 5月26日基金净值:信澳鑫安债券(LOF)最新净值1.009,跌0.39%
  • 6月7日基金净值:广发价值优势混合最新净值1.389,跌0.1%
  • 4月28日基金净值:嘉实新消费股票最新净值2.457,涨1.57%