[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删去)