1.下载mysql deb

https://dev.mysql.com/downloads/mysql/

安装 mysql5.7.2 (Ubuntu 16.04 desktop amd64)_bundle

 

 

 

#移动到/usr/local/src/目录,解压

sudo mv mysql-server_5.7.24-1ubuntu16.04_amd64.deb-bundle.tar /usr/local/src/
cd /usr/local/src/
sudo tar -xvf mysql-server_5.7.24-1ubuntu16.04_amd64.deb-bundle.tar

 

#更新,安装依赖

sudo apt-get update
sudo apt-get install libaio1

 

#安装MySQL

sudo dpkg -i mysql-common_5.7.24-1ubuntu16.04_amd64.deb
sudo dpkg-preconfigure mysql-community-server_5.7.24-1ubuntu16.04_amd64.deb
sudo dpkg -i libmysqlclient20_5.7.24-1ubuntu16.04_amd64.deb
sudo dpkg -i libmysqlclient-dev_5.7.24-1ubuntu16.04_amd64.deb
sudo dpkg -i mysql-community-client_5.7.24-1ubuntu16.04_amd64.deb
sudo dpkg -i mysql-client_5.7.24-1ubuntu16.04_amd64.deb
sudo apt-get -f install
sudo apt-get -f install libmecab2
sudo dpkg -i mysql-community-server_5.7.24-1ubuntu16.04_amd64.deb
sudo dpkg -i mysql-server_5.7.24-1ubuntu16.04_amd64.deb

 

#进入MySQL: mysql -u root -p

 #启动: sudo service mysql start

 #重启:sudo  service mysql restart 

#关闭: sudo service mysql stop

#检查mysql是否在运行:  sudo service mysql status

 

1、数据库目录
/var/lib/mysql/
2、配置文件
/usr/share/mysql(mysql.server命令及配置文件)
3、相关命令
/usr/bin(mysqladmin mysqldump等命令)
4、启动脚本
/etc/rc.d/init.d/(启动脚本文件mysql的目录)