安装准备:
- 安装MySQL5.7时需要到MySQL官网下载对应的deb包 :https://repo.mysql.com/apt/ubuntu/pool/mysql-5.7/m/mysql-community/
- MySQL需要使用的包:(
***
代表版本号)
1.mysql-common_***
2.mysql-community-client_***
3.mysql-client_***
4.mysql-community-server_***
其中MySQL5.7.29 需要以下包:
mysql-common_5.7.29-1ubuntu18.04_amd64.deb
mysql-community-client_5.7.29-1ubuntu18.04_amd64.deb
mysql-client_5.7.29-1ubuntu18.04_amd64.deb
mysql-community-server_5.7.29-1ubuntu18.04_amd64.deb
备注:
开始操作
在安装包所在的目录下执行(安装顺序不可更改)
1、安装mysql-common_5.7.29-1ubuntu18.04_amd64.deb
sudo dpkg -i mysql-common_5.7.29-1ubuntu18.04_amd64.deb
2、安装mysql-community-client_5.7.29-1ubuntu18.04_amd64.deb
sudo dpkg -i mysql-community-client_5.7.29-1ubuntu18.04_amd64.deb
会提示缺少依赖包libaio1:
执行安装命令:sudo apt install libaio1
然后在执行??的 安装mysql-community-client_5.7.29-1ubuntu18.04_amd64.deb
3、安装mysql-client_5.7.29-1ubuntu18.04_amd64.deb
sudo dpkg -i mysql-client_5.7.29-1ubuntu18.04_amd64.deb
4、安装 mysql-community-server_5.7.29-1ubuntu18.04_amd64.deb
安装过程中会提示缺少依赖包libmecab2:
所以这次先安装依赖包libmecab2
:
sudo dpkg -i libmecab2_0.996-1.1_amd64.deb
然后安装mysql-community-server_5.7.29-1ubuntu18.04_amd64.deb
sudo dpkg -i mysql-community-server_5.7.29-1ubuntu18.04_amd64.deb
安装过程中会要求在粉色的大页面上输入密码,输入两次即可,至此安装完成。
启动mysql:service mysql start
停止mysql:service mysql stop
重启mysql:service mysql restart
补充:
关于配置文件my.cnf说明:Ubuntu中MySQL有多个配置文件
MySQL读取各个my.cnf配置文件的先后顺序是:/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf
其他增加:
1、root用户远程任意主机登陆:
/etc/mysql/mysql.conf.d/mysqld.cnf 文件。将其中的 bind-address 注释掉。然后重启数据库;
2、大小写不敏感设置:lower_case_table_names = 1
vim /etc/mysql/mysql.conf.d/mysqld.cnf
引用:https://www.jianshu.com/p/ba48f1e386f0