yum安裝mysql、mysql的編碼修改(utf-8)以及Mysql對其它機器訪問的IP以及許可權限

來源:互聯網
上載者:User

標籤:

一:安裝Mysql 1. 檢查mysql是否以及安裝 .

rpm -qa | grep mysql // 這個命令就會查看該作業系統上是否已經安裝了mysql資料庫
rpm -e mysql  // 普通刪除模式
rpm -e –nodeps mysql// 強力刪除模式,如果使用上面命令刪除時,提示有依賴的其它檔案,則用該命令可以對其進行強力刪除
ps:在刪除完以後我們可以通過 rpm -qa | grep mysql 命令來查看mysql是否已經卸載成功!!

2. yum安裝mysql

yum list | grep mysql //查看yum上提供的mysql資料庫可下載的版本
yum install -y mysql-server mysql mysql-devel //將mysql mysql-server mysql-devel都安裝好

3. 啟動、停止mysql

service mysqld start/stop/restart

4. 修改預設mysql root使用者的密碼

/usr/bin/mysqladmin -u root password ‘new-password‘  // 為root帳號設定密碼

二: mysql編碼的修改(utf-8) 1. 修改設定檔

vi /etc/my.cnf //編輯mysql的主設定檔。如果沒有,去/usr/share/mysql拷貝一份(my-medium.cnf)即可

[client]
default-character-set=utf8
[mysqld]
collation-server = utf8_unicode_ci
init-connect=‘SET NAMES utf8‘
character-set-server=utf8

2. 驗證我們的編碼是否改好

mysql>SHOW VARIABLES LIKE ‘character%‘;
mysql>show variables like ‘collation%‘;


三: mysql的授權 1.關於這類東東,就去google下相關文章看看就ok了。

http://jiony.iteye.com/blog/1672912
http://cnzxp521.iteye.com/blog/1332876
http://freeloda.blog.51cto.com/2033581/1253898

2.具體的

GRANT ALL PRIVILEGES ON . TO ‘root‘@‘192.168.15.115‘ IDENTIFIED BY ‘123‘ WITH GRANT OPTION;//授權
GRANT ALL PRIVILEGES ON . TO ‘root‘@‘192.168.15.%‘ IDENTIFIED BY ‘123‘ WITH GRANT OPTION;//授權
revoke alter on . from ‘root‘@‘192.168.15.115‘ identified by ‘123‘;//取消授權
FLUSH PRIVILEGES; //重新整理

yum安裝mysql、mysql的編碼修改(utf-8)以及Mysql對其它機器訪問的IP以及許可權限

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.