天天看點

Ubuntu之Mysql安裝及基本設定

No1. Mysql 安裝

sudo apt-get install mysql-server mysql-client      

記得root密碼别忘了。

No2. 驗證Mysql安裝

sudo service mysql restart      

No3. 設定Mysql遠端IP通路

/etc/MySQL/my.cnf找到bind-address = 127.0.0.1,注釋掉

No4. 設定字元集、排序規則等。

打開/etc/mysql/my.cnf,在[mysqld]後添加character-set-server=utf8

No5. 設定root遠端通路(password為root密碼)

mysql -u root -p
->GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
->FLUSH PRIVILEGES;      

重新開機mysql服務即可生效!