Я установил MySQL в CentOS, используя sudo yum install mysql-server
и вошел в MySQL, используя mysql -u root -p
и дал пустой пароль. Это не позволяет мне использовать базу данных MySQL или выбирать пользователей/обновлять пароль/создавать базу данных.MySQL CentOS: доступ запрещен для пользователя '@' localhost 'в базу данных
mysql> select user();
+----------------+
| user() |
+----------------+
| [email protected] |
+----------------+
1 row in set (0.00 sec)
mysql> use mysql;
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'
mysql> UPDATE user SET Password=PASSWORD('*****') WHERE user='root';
ERROR 1046 (3D000): No database selected
mysql> show grants;
+--------------------------------------+
| Grants for @localhost |
+--------------------------------------+
| GRANT USAGE ON *.* TO ''@'localhost' |
+--------------------------------------+
1 row in set (0.00 sec)
[[email protected]****~]$ sudo /sbin/service mysqld stop
Redirecting to /bin/systemctl stop mysqld.service
[[email protected]****~]$ sudo mysqld_safe
151026 14:40:32 mysqld_safe Logging to '/var/log/mysqld.log'.
151026 14:40:32 mysqld_safe A mysqld process already exists
[[email protected]*****~]$ mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 152
Server version: 5.6.27 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use mysql;
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'
mysql>
Ошибка снова:
[[email protected]~]$ sudo /sbin/service mysqld stop
Redirecting to /bin/systemctl stop mysqld.service
[centos~]$ sudo mysqld_safe --skip-grant-tables &
[1] 25678
[centos~]$ 151026 14:53:07 mysqld_safe Logging to '/var/log/mysqld.log'.
151026 14:53:07 mysqld_safe A mysqld process already exists
[1]+ Exit 1 sudo mysqld_safe --skip-grant-tables
[[email protected]~]$ sudo mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 160
Server version: 5.6.27 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use mysql;
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'
Пожалуйста, дайте мне знать, как решить эту проблему.
Вы не изменяете пользователя db вручную. 'установить пароль для root @ localhost = password ('*****')' –
Это вызывает у меня ошибку, когда я это делаю. mysql> установить пароль для root @ localhost = password ('****'); ОШИБКА 1133 (42000): Невозможно найти подходящую строку в таблице пользователя – CentosUser