1.centos6.5中修改mysql的登錄密碼。
[root@CMSTest ~]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
報錯信息,
解決辦法:
[root@CMSTest ~]# /etc/init.d/mysqld stop
停止 mysqld: [確定]
[root@CMSTest ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[root@CMSTest ~]# mysql -u root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, 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.
現在開始修改密碼 紅色是新的密碼 默認是在root賬戶下修改色是新的密碼 默認是在root賬戶下修改
mysql> UPDATE user SET Password=PASSWORD('77066188') where USER='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
下面要做的事重啓mysql
root@CMSTest ~]# /etc/init.d/mysqld restart
141105 16:47:10 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
停止 mysqld: [確定]
正在啓動 mysqld: [確定]
[1]+ Done mysqld_safe --user=mysql --skip-grant-tables --skip-networking
重新登錄mysql
[root@CMSTest ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.73 Source distribution
在紅色輸入剛剛你修改的密碼。就可以進來mysql
2.無法登錄phpmyadmin,報1130錯誤
centos安裝配置好phpmyadmin web登錄phpmyadmin界面報錯
1.解決方法,
[root@CMSTest ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, 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;
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
mysql> select 'host' from user where user='root';
+------+
| host |
+------+
| host |
| host |
| host |
+------+
3 rows in set (0.00 sec)
使用授權的方法,授予用戶遠程訪問的權限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
mysql> select user,host from user;
+------+-----------+
| user | host |
+------+-----------+
| root | % |
| root | 127.0.0.1 |
| | cmstest |
| root | cmstest |
| | localhost |
+------+-----------+
5 rows in set (0.00 sec)
mysql> grant all privileges on *.* to 'root'@'%' identified by '77066188' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> select user,host from user;
+------+-----------+
| user | host |
+------+-----------+
| root | % |
| root | 127.0.0.1 |
| | cmstest |
| root | cmstest |
| | localhost |
+------+-----------+
5 rows in set (0.00 sec)
mysql> quit
Bye
下面是相關命令
582 /etc/init.d/mysqld stop
583 mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
584 mysql -u root mysql
585 /etc/init.d/mysqld restart
586 mysql -u root -p
587 /etc/init.d/mysql stop
588 /etc/init.d/mysqld stop
589 mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
590 mysql -u root mysql
591 /etc/init.d/mysqld restart
592 mysql -u root -p
593 /etc/init.d/mysqld restart
594 [root@CMSTest ~]# /etc/init.d/mysqld stop
595 停止 mysqld:
退出MySQL之後重啓再轉會phpmyadmin登錄界面。現在你可以登錄試試看啦。