yum安裝mysql資料庫

來源:互聯網
上載者:User

標籤:server   資料庫   作業系統   修改密碼   localhost   

1) 作業系統環境:CentOS6.6

2) 任務:源碼安裝mysql

3)  問題:mysql源碼配置失敗,不知道是包的問題還是系統缺少庫檔案?沒法編譯,通過rpm包也無法安裝,以失敗告終。

4)   解決:為瞭解決問題,通過採用yum安裝成功MYSQL資料庫。

5)   裝過程如下:

[[email protected] tools]#yum –y install  mysql-server

[[email protected] tools]#yum  -y install php-mysql

[[email protected] tools]# chkconfig mysqld on

[[email protected] tools]# service mysqldstart

[[email protected] tools]# mysqladmin -u rootpassword sky   //無法修改密碼

mysqladmin: connect to server at‘localhost‘ failed

error: ‘Access denied for user‘root‘@‘localhost‘ (using password: NO)‘

[[email protected] tools]# service mysqld stop

[[email protected] tools]# mysqld_safe--skip-grant-tables &

[[email protected] tools]#update user setpassword=PASSWORD("sky")where user="root";

[[email protected] tools]# mysql –u root –p

Msql>

Mysql>use mysql

mysql> update user set password=PASSWORD("sky")whereuser="root";

Query OK, 0 rows affected (0.00 sec)

Rows matched: 3  Changed: 0 Warnings: 0

mysql> flush privileges;  //更新許可權

Query OK, 0 rows affected (0.00 sec)

//到此為止,你設定了新密碼,通過新密碼正常可以登入到mysql資料。

注意事項:既然是通過yum安裝,通常我們要配置和最佳化資料庫,哪麼就要清楚設定檔存放在哪,所以說我們掌握原始碼安裝方式非常重要,下列是通過yum源安裝常用的預設目錄:

資料庫目錄:/var/lib/mysql/

設定檔:/usr/share/mysql

相關命令:/usr/bin   [例如mysql、mysqladmin、mysqldump、mysqlshow等]

啟動指令碼:/etc/rc.d/init.d/

 


本文出自 “營運” 部落格,請務必保留此出處http://sky9896.blog.51cto.com/2330653/1591391

yum安裝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.