phpmyadmin登录报错外加linux下修改mysql登录密码

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登录界面。现在你可以登录试试看啦。


spacer.gifspacer.gif



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章