Ubuntu下MySQL安装及基本设置

No1. Ubuntu下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远程访问

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

重启mysql服务即可生效!

相关推荐