Linux作業系統上的mysql安裝

來源:互聯網
上載者:User

標籤: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安裝

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.