大家好:我是小狼,最近工作一直瞎忙,没时间写东西,终于有点时间了,现在我正在搭建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了。