安装(转自http://www.cnblogs.com/xz1024/p/5802637.html):
deb安装:
一、下载MySQL
到mysql网站下载相应的mysql安装包,我的mysql-server_5.7.16-1ubuntu16.04_amd64.deb-bundle.tar
二、解压
tar -xvf mysql-server_5.7.16-1ubuntu16.04_amd64.deb-bundle.tar
得到一下文件:
libmysqlclient20_5.7.16-1ubuntu16.04_amd64.deb
libmysqlclient-dev_5.7.16-1ubuntu16.04_amd64.deb
libmysqld-dev_5.7.16-1ubuntu16.04_amd64.deb
mysql-client_5.7.16-1ubuntu16.04_amd64.deb
mysql-common_5.7.16-1ubuntu16.04_amd64.deb
mysql-community_5.7.16-1ubuntu16.04_amd64.changes
mysql-community-client_5.7.16-1ubuntu16.04_amd64.deb
mysql-community-server_5.7.16-1ubuntu16.04_amd64.deb
mysql-community-source_5.7.16-1ubuntu16.04_amd64.deb
mysql-community-test_5.7.16-1ubuntu16.04_amd64.deb
mysql-server_5.7.16-1ubuntu16.04_amd64.deb
mysql-server_5.7.16-1ubuntu16.04_amd64.deb-bundle.tar
mysql-testsuite_5.7.16-1ubuntu16.04_amd64.debsan
三、安装所需的包
1、sudo dpkg -i mysql-common_5.7.16-1ubuntu16.04_amd64.deb
2、sudo dpkg-preconfigure mysql-community-server_5.7.16-1ubuntu16.04_amd64.deb
输入root密码
3、sudo dpkg -i libmysqlclient20_5.7.16-1ubuntu16.04_amd64.deb
4、sudo dpkg -i libmysqlclient-dev_5.7.16-1ubuntu16.04_amd64.deb
5、sudo dpkg -i libmysqld-dev_5.7.16-1ubuntu16.04_amd64.deb
6、sudo dpkg -i mysql-community-client_5.7.16-1ubuntu16.04_amd64.deb 注意:安装此步前需要安装libaio1 apt-get install libaio1
7、sudo dpkg -i mysql-client_5.7.16-1ubuntu16.04_amd64.deb
8、sudo dpkg -i mysql-common_5.7.16-1ubuntu16.04_amd64.deb
9、sudo dpkg -i mysql-community-server_5.7.16-1ubuntu16.04_amd64.deb 注意:安装此步前需要安装libmecab2 apt-get install libmecab2
10、sudo dpkg -i mysql-server_5.7.16-1ubuntu16.04_amd64.deb
四、安装完成,查看路径及依赖
whereis mysql
mysql: /usr/bin/mysql /usr/lib/mysql /etc/mysql /usr/include/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
五、查看版本
mysql --version
mysql Ver 14.14 Distrib 5.7.16, for Linux (x86_64) using EditLine wrapper
六、登录
mysql -u用户名 -p密码
直接安装(简单方便好用。。):
1. sudo apt-get install mysql-server
2. sudo apt-get install mysql-client
3. sudo apt-get install libmysqlclient-dev
卸载(转自http://www.blogjava.net/yjhmily/articles/336926.html):
1、删除 mysql
2 sudo apt-get remove mysql-server
3 sudo apt-get autoremove mysql-server
4 sudo apt-get remove mysql-common (非常重要)
上面的其实有一些是多余的,建议还是按照顺序执行一遍
清理残留数据