安装mysql5.6
1.升级apt-get
sudo apt-get update
2.安装mysql-client-core-5.6
sudo apt-get install mysql-client-core-5.6
3.安装mysql-client-5.6
sudo apt-get install mysql-client-5.6
4.安装mysql-server-5.6
sudo apt-get install mysql-server-5.6
5.检查mysql是否启动
(1) 查看mysql进程是否运行
ps-ef | grep mysql
(2)查看mysql监听端口
netstat -tap | grep mysql
6.停止mysql服务
sudo service mysql stop
7.启动mysql服务
sudo service mysql start
8.重启mysql服务
sudo service mysql restart
mysql服务远程访问
1.注释绑定127.0.0.1
sudo vim /etc/mysql/my.cn
Mysql服务支持远程访问
2.重启mysql
sudo service mysql restart
授权非本机用户登录数据库
1.登录数据库,执行命令
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
2.刷新权限
mysql> FLUSH PRIVILEGES;
授权非本机用户登录数据库
修改mysql服务端的编码方式
1.查看mysql服务端的编码方式
mysql> status
2.修改配置文件
sudo vim /etc/mysql/my.cnf
(1) 在[client]下追加 default-character-set = utf8
(2) 在[mysqld]下追加character-set-server = utf8
(3) 在[mysql]下追加default-character-set = utf8
3.保存退出,重启服务
sudo service mysql restart
注: 如果重启报错,请更改第二步,将[mysqld]区块的character-set-server = utf8改为
character-set-server = utf8
collation-server = utf8_general_ci












网友评论