Ubuntu14.04使用DEB安装Mysql5.7
- 下载deb-bundle包
1.mysql下载页面
2.解压
- 安装(注意安装顺序)
安装顺序如下:
1.mysql-common_5.7.10-1ubuntu14.04_amd64.deb
2.libmysqlclient20_5.7.10-1ubuntu14.04_amd64.deb
3.libmysqlclient-dev_5.7.10-1ubuntu14.04_amd64.deb
4.libmysqld-dev_5.7.10-1ubuntu14.04_amd64.deb
5.mysql-community-client_5.7.10-1ubuntu14.04_amd64.deb
6.mysql-client_5.7.10-1ubuntu14.04_amd64.deb
7.mysql-community-server_5.7.10-1ubuntu14.04_amd64.deb
一、安装命令
- sudo dpkg -i mysql-common_5.7.10-1ubuntu14.04_amd64.deb libmysqlclient20_5.7.10-1ubuntu14.04_amd64.deb libmysqlclient-dev_5.7.10-1ubuntu14.04_amd64.deb libmysqld-dev_5.7.10-1ubuntu14.04_amd64.deb mysql-client_5.7.10-1ubuntu14.04_amd64.deb mysql-community-server_5.7.10-1ubuntu14.04_amd64.deb
二、输入root密码,OK
三、查看是否安装成功,命令
- service mysql start
看到表示启动成功
四、进入mysql,命令
- mysql -u root -p
- 修改默认路径
- sudo service mysql stop #停止 MySQL 服务
- mv /var/lib/mysql /data
- vi /etc/mysql/my.cnf #将 datadir 对应的值改为 /data/mysql
- vi /etc/apparmor.d/usr.sbin.mysqld #将所有 /var/lib/mysql 改为 /data/mysql
- sudo service apparmor restart #重启appparmor服务
- sudo service mysql start