今天,我想在PMA中创建一个数据库。它说:“无法登录到MySQL服务器”。我通过终端尝试了同样的问题,这是因为我的密码错误。我不明白为什么。
我尝试了通常的方法来重置根密码(跳过安装授权表并重置密码),但似乎不起作用。
看到:
morgan@rakija:~$ sudo mysqld_safe --skip-grant-tables &
[1] 14016
morgan@rakija:~$ 150802 19:07:25 mysqld_safe Can't log to error log and syslog at the same time. Remove all --log-error configuration options for --syslog to take effect.
150802 19:07:25 mysqld_safe Logging to '/var/log/mysql/error.log'.
150802 19:07:25 mysqld_safe A mysqld process already exists
[1]+ Terminé 1 sudo mysqld_safe --skip-grant-tables
morgan@rakija:~$ mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.0.20-MariaDB-0ubuntu0.15.04.1 (Ubuntu)
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use mysql;
Database changed
MariaDB [mysql]> update user set password=PASSWORD("newPass") where user='root';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> exit
Bye
morgan@rakija:~$ sudo service mysql restart
morgan@rakija:~$ mysql -uroot -pnewPass
ERROR 1698 (28000): Access denied for user 'root'@'localhost'