因为希望mysql支持json格式,所以选择安装mysql5.7,debian纯属个人喜好。
一、首先去mysql官网找到你要下的包,地址如下:
https://downloads.mysql.com/archives/community/
二、把下好的包拷到debian里,解压
tar -vxf mysql-server_5.7.19-1debian8_amd64.deb-bundle.tar
三、安装依赖,debian系其他发行版请自行加sudo
apt-get install libaio1
apt-get install libnuma1
apt-get install libmecab2
四、依次安装解压出来的deb包,顺序如下:(亲测可行)
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-community-client_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
安装命令:
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的密码,完了以后就完成啦!
ps:
修改远程连接:
mysql -uroot -p你刚才设置的密码
use mysql;
update user set host='%' where user='root';
修改/etc/mysql/mysql.conf.d下的mysqld.cnf
bind-address = 127.0.0.1 改成 # bind-address = 127.0.0.1
(这里如果不改变可能不能远程连接成功)
在文件末尾加上sql_mode=’NO_ENGINE_SUBSTITUTION’
(这个是远程连接成功后插入数据报错需要加的)
附:
/etc/init.d/mysql start //启动mysql
/etc/init.d/mysql start //重启mysql
/etc/init.d/mysql stop //关闭mysql