1.下载对应二进制包
cd /usr/local/src
sudo wget http://dev.mysql.com/downloads/file/?id=465030
2.解压并放在/usr/local目录下改名为mysql
sudo tar zxvf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz
sudo mv mysql-5.6.33-linux-glibc2.5-x86_64 /usr/local/mysql
3.创建mysql分组和用户,更改mysql所属用户和用户组
groupadd mysql
useradd -g mysql mysql -s /bin/false
sudo chown -R mysql:mysql /usr/local/mysql
4.初始化mysql
sudo rm -rf /etc/my.cnf
sudo ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql
5.设置mysql启动命令
sudo cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
sudo chmod +x /etc/init.d/mysql
6.mysql启动
sudo /etc/init.d/mysql (start|stop|force-quit|restart|reload|status)
7.初始化mysql密码
cd /usr/local/mysql/bin
sudo ./mysqladmin -u root password root(密码)
8.通过自带mysql client连接数据库
cd /usr/local/mysql/bin
sudo ./mysql -u root -p
9.查看mysql运行情况:
sudo lsof -i:3306
10.扩展设置开机就启动
sudo apt-get install sysv-rc-conf
sudo sysv-rc-conf php-fpm on
11.配置外网访问
grant all privileges on *.* to qingpz@"%" identified by '234@#@4454*23' with grant option;
flush privileges;