因為是新手所以采用簡單的yum命令安裝:
做到這一步是完全沒有問題的,但是更改密碼的時候 就出現(xiàn)問題了。因為安裝mysql的時候默認的root是沒有密密的,這也無所謂了,但是修改root用戶密碼的時候就出現(xiàn):
(參考別人的:http://blog.sina.com.cn/s/blog_6fd605b50100q5es.html)
解決辦法:
修改mysql登錄設(shè)置
vi /etc/my.cnf
在[mysqld]段中加入
skip-grant-tables
保存之后重啟mysql服務
service mysqld restart
或者直接service mysqld stop
mysqld_safe
skip-grant-tables
效果一樣。
重啟mysql服務之后修改mysql密碼
[root@localhost Anylinux]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 3.23.56
Type 'help;' or '\h' for help. Type '\c' to clear the
buffer.
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> UPDATE user SET Password = password (
'anylinux' ) WHERE User = 'root' ;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2 Changed: 0 Warnings: 0
mysql> flush privileges ;
Query OK, 0 rows affected (0.01 sec)
mysql> quit
Bye
然后還原my.cnf就行了?。?!