mysql -u 报错_MySQL报错解决!
大家好:我是小狼,最近工作一直瞎忙,沒時間寫東西,終于有點時間了,現在我正在搭建extmail服務器,文檔是參考這里:http://www.extmail.org/forum/thread-7002-1-1.html
做到安裝 ExtMail 1.0.3 和 ExtMan 0.2.3需要導入 ExtMail 和 ExtMan 所需要的數據庫時,輸入下面命令會報錯:mysql -u root -p < /usr/local/apache2/htdocs/extsuite/extman/docs/extmail.sql
報錯信息為:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
我在網上查了半天終于在一個人的文檔里面找到解決方法了,他帖子地址是:http://www.jb51.net/LINUXjishu/10981.html
方法如下:
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD(‘newpassword’) where USER=‘root’;
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysql restart
# mysql -uroot -p
Enter password:
mysql>
下面是我的操作:
# /etc/init.d/mysql stop
mysql -u root -p
Enter password: (此處用空密碼登陸,要多嘗試幾次才成功的,不知原因)
Welcome to the MySQL monitor.? Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.45-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use mysql;
Database changed
mysql> UPDATE user SET Password=PASSWORD('redhat') where USER='root';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2? Changed: 2? Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root@localhost ~]# 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.0.45-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> quit
Bye
按照此方法做成功了,mysql -u root -p 之后會讓你輸入密碼,輸入剛才設置的密碼進入數據庫就OK了。
總結
以上是生活随笔為你收集整理的mysql -u 报错_MySQL报错解决!的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 内存不兼容,蓝屏频繁!我的解决方法
- 下一篇: i5 2400处理器兼容性大揭秘:160