Unbuntu下Mysql安装和简单配置

ubuntu搭建mysql 参考http://www.cnblogs.com/wuhou/archive/2008/09/28/1301071.html
1. sudo apt-get install mysql-server
需要制定root密码password吧
2. vi /etc/mysql/my.cnf
注释掉binding-address=127.0.0.1
3.如果需要在服务器端配置mysql,安装mysql-client
mysql -u root p
4. 如果需要远程连接数据库服务器,需要开启权限(默认是不可以远程连接的:navicat 1130错误)
mysql> grant all privileges on *.* to root@"%" identified by "password" with grant option; (任何主机均可以)
grant all privileges on *.* to root@"192.168.1.3" identified by "password" with grant option; flush privileges(指定主机)

注意mysql库中的user表记录了连接信息
5. 修改字符集 (注意乱码问题http://www.2cto.com/database/201108/101151.html)
查看当前的编码:show variables like 'character%';
修改my.cnf,在[client]下添加default-character-set=utf8
create database ‘sb’ character et 'utf8'

原文地址:https://www.cnblogs.com/dijkstra-c/p/4437713.html