centos安装OpenStack error1045root访问受限

[root@localhost ~]# mysql -uroot -p000000
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

[root@localhost ~]# su -s /bin/sh -c "nova-manage api_db sync" nova
[root@localhost ~]# mysql -uroot -p000000
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

[root@localhost ~]# service mysqld stop
Redirecting to /bin/systemctl stop mysqld.service

[root@localhost ~]# whereis my
my: /etc/my.cnf
[root@localhost ~]# vi /etc/my.cnf
(在打开的文件中最后一行加入skip-grant-tables)

(重启数据库)
[root@localhost ~]# systemctl start mysqld.service mysqld start
Failed to start start.service: Unit not found.

(之前重启失败,试了一下其他语句 这是通过rpm包安装的MySQL可以用的)
[root@localhost ~]# service mysqld restart
Redirecting to /bin/systemctl restart mysqld.service
[root@localhost ~]# mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 10.3.20-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 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
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.059 sec)

MariaDB [mysql]> quit;
Bye
[root@localhost ~]# vi /etc/my.cnf
(把之前加入的skip-grant-tables删去)


版权声明:本文为dregs_原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。