Ubuntu 16.04 LTS X64 Install MySQL Community Server 5.7.19

Ubuntu 16.04 LTS X64 Install MySQL Community Server 5.7.19

###版本确认
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04 LTS
Release:    16.04
Codename:   xenial
root@bzm-virtual-machine:/home# uname -a
Linux bzm-virtual-machine 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

###下载(建议直接上传,下载速度慢)
cd /home
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-server_5.7.19-1ubuntu16.04_amd64.deb-bundle.tar
 tar -xvf mysql-server_5.7.19-1ubuntu16.04_amd64.deb-bundle.tar


###安装依赖包
sudo apt-get upgrade
sudo apt-get install libaio1
###安装deb包
sudo dpkg -i mysql-common_5.7.19-1ubuntu16.04_amd64.deb
sudo dpkg -i libmysqlclient20_5.7.19-1ubuntu16.04_amd64.deb
sudo dpkg -i libmysqlclient-dev_5.7.19-1ubuntu16.04_amd64.deb
sudo dpkg -i libmysqld-dev_5.7.19-1ubuntu16.04_amd64.deb
sudo dpkg -i mysql-community-client_5.7.19-1ubuntu16.04_amd64.deb
sudo dpkg -i mysql-client_5.7.19-1ubuntu16.04_amd64.deb
sudo dpkg -i mysql-community-source_5.7.19-1ubuntu16.04_amd64.deb

###libmecab2 安装
sudo apt-get -f install   
sudo dpkg -i mysql-community-server_5.7.19-1ubuntu16.04_amd64.deb

###这边会提示设置root密码

###Error 处理:
dpkg: 依赖关系问题使得 mysql-community-server 的配置工作不能继续:
 mysql-community-server 依赖于 libmecab2 (>= 0.996-1.2ubuntu1);然而:
  未安装软件包 libmecab2。
sudo apt-get install libmecab2 


--finish it------------------------------

# 启动MySQL$ sudo service mysql start 
# 关闭MySQL$ sudo service mysql stop
# 重启MySQL$ sudo service mysql restart
# 其他命令:$ sudo /etc/init.d/mysql start
$ sudo /etc/init.d/mysql stop
$ sudo /etc/init.d/mysql restart

-----------
配置文件修改
配置文件路径(相比以前版本有变更,56路径:/etc/MySQL/my.conf) 
57路径: /etc/mysql/mysql.conf.d/mysqld.cnf

--绑定IP修改
找到bind-address = 127.0.0.1这一行 
改为bind-address = 0.0.0.0,问题解决。
--大小写区分修改
[mysqld]后添加添加lower_case_table_names=1,重启MYSQL服务,这时已设置成功:不区分表名的大小写; 
lower_case_table_names参数详解: 
lower_case_table_names = 0 
其中 0:区分大小写,1:不区分大小写

避免:Mysql [Err] 1055 
vim  /etc/mysql/mysql.conf.d/mysqld.cnf
############编辑配置文件,增加行:
############sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
service mysql restart


--root 用户远程权限
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select host,user from  user;

mysql> update user set host = '%' where user ='root'; 
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select host,user from  user;

mysql> flush privileges; 
Query OK, 0 rows affected (0.00 sec)

你可能感兴趣的:(Mysql)