mysql 忘记 root 密码

来源:互联网 发布:刷黄金卷轴软件 编辑:程序博客网 时间:2024/06/05 18:51
# service mysql start# mysqlERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)# mysql -u root -pEnter password: 123456ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)# /etc/init.d/mysql stopShutting down MySQL..                                   [  OK  ]# mysqld_safe --skip-grant-tables &160602 19:38:55 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql# mysqlmysql> use mysqlmysql> update user set password=password("123456") where user="root";mysql> exit# /etc/init.d/mysql restartShutting down MySQL..160602 19:41:32 mysqld_safe mysqld from pid file /var/lib/mysql/CS4.sz.fonsview.com.pid ended                                                        [  OK  ]Starting MySQL.                                         [  OK  ][1]+  Done  mysqld_safe --skip-grant-tables# mysql -u root -pEnter password: 123456Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.6.29-logmysql> show databases;ERROR 1820 (HY000): You must SET PASSWORD before executing this statementmysql> SET PASSWORD = PASSWORD('123456');mysql> show databases;+--------------------+| Database           |+--------------------+| information_schema || mysql              || performance_schema |+--------------------+# chkconfig --list  //默认开机启动列表查询# chkconfig --level 2345 mysql on //设置默认开机启动

原创粉丝点击