標籤:localhost password search linux 作業系統
話說,這次安裝mysql真是一波三折,沒想到這麼的麻煩。我是用yum源安裝的,首先提供用yum安裝mysql的一些事項。
一定要配好yum 源,yum 源有問題的可以參照我前面的部落格內容
1、安裝MySQL
yum install mysql-server --這裡一定是mysql-server,不能夠是 yum install mysql,mysql-server才是服務 端,可以使用yum search mysql來查看yum 源裡面關於mysql的一些包。
2、啟動MySQL
/etc/init.d/mysqld start
3、為root使用者佈建密碼
mysql -uroot -p --報錯了
Linux mysql 5.6: ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)
解決方案:
a、首先停掉mysql
/etc/init.d/mysqld stop
b、
[[email protected] init.d]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking & --跳過許可權表和網路通訊協定
[[email protected] init.d]# 1 mysqld_safe Logging to ‘/var/lib/mysql/DB-Server.err‘.
140722 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
這裡直接ctrl +c 就可以,接著進行下一步。
c、mysql -u root mysql --進入mysql
mysql>update user set password=PASSWORD(‘123456‘) where user=‘root‘ and host=‘root‘ or host=‘localhost‘;
mysql> flush privileges;
mysql> quit
/etc/init.d/mysqld restart --重啟mysql
mysql -u root -p 就可以設定新密碼了
Linux作業系統上的mysql安裝