sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libaio1
--不要使用下面语句装
(apt-get install MysqL-server MysqL-client自动安装会装上5.5)
sudo groupadd MysqL
sudo useradd -r -g MysqL MysqL
cd /usr/local/src
sudo chmod +x MysqL-server_5.7.10-1ubuntu14.04_amd64.deb-bundle.tar
tar -xf MysqL-server_5.7.10-1ubuntu14.04_amd64.deb-bundle.tar
ps:会解压出以下文件
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-community-server_5.7.10-1ubuntu14.04_amd64.deb
MysqL-community-source_5.7.10-1ubuntu14.04_amd64.deb
MysqL-client_5.7.10-1ubuntu14.04_amd64.deb
MysqL-community-test_5.7.10-1ubuntu14.04_amd64.deb
MysqL-common_5.7.10-1ubuntu14.04_amd64.deb
MysqL-server_5.7.10-1ubuntu14.04_amd64.deb
MysqL-community_5.7.10-1ubuntu14.04_amd64.changes
MysqL-testsuite_5.7.10-1ubuntu14.04_amd64.deb
更新设置到最新系统:
apt-get install libaio1
然后分别安装以下的包:
sudo dpkg -i MysqL-common_5.7.10-1ubuntu14.04_amd64.deb
sudo dpkg-preconfigure MysqL-community-server_5.7.10-1ubuntu14.04_amd64.deb
此步需要输入数据的root密码
sudo dpkg -i libMysqLclient20_5.7.10-1ubuntu14.04_amd64.deb
sudo dpkg -i libMysqLclient-dev_5.7.10-1ubuntu14.04_amd64.deb
sudo dpkg -i libMysqLd-dev_5.7.10-1ubuntu14.04_amd64.deb
sudo dpkg -i MysqL-client_5.7.10-1ubuntu14.04_amd64.deb
sudo dpkg -i MysqL-community-client_5.7.10-1ubuntu14.04_amd64.deb
sudo apt-get -f install
此步为了安装依赖包 libmecab2
sudo dpkg -i MysqL-community-server_5.7.10-1ubuntu14.04_amd64.deb
sudo dpkg -i MysqL-server_5.7.10-1ubuntu14.04_amd64.deb
这时数据安装完成,并自动启动
查看MysqL安装的路径和依赖:
whereis MysqL
MysqL: /usr/bin/MysqL /etc/MysqL /usr/lib/MysqL /usr/include/MysqL /usr/share/MysqL /usr/share/man/man1/MysqL.1.gz
这时你会发现 MysqL以服务形式自启动
这时候在
本机可以通过 MysqL -r root -p 登录了
2、开启远程访问访问
默认情况下远程访问会出现Can’t connect to MysqL server on ‘192.168.10.18′ (
10061) 错误
是因为,MysqL的默认配置为了增强安全性,禁止了非本机的访问,在ubuntu中是这样,debian中也是。禁止的方式以前是在my.cnf中有一句
skip-network
现在则变成了:
# Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. bind-address = 127.0.0.1
就是只监听本机地址。所以,如果要开放局域网内的访问,需要注释掉这一句,或者改成:
bind-address = 0.0.0.0
就行了
# vi /etc/MysqL/my.cnf
bind-address = 127.0.0.1 为 bind-address = 0.0.0.0
修改完成后重启MySQL服务
#sudo /etc/init.d/MysqL restart
这样改完3306端口就开始监听了,但是MysqL的权限还没有打开ROOT远程登陆
MysqL默认是不允许远程连接的,因为有很大的安全隐患。
需要手动增加可以远程访问数据库的用户。
方法一、本地登入MysqL,更改 "MysqL" 数据库里的 "user" 表里的 "host" 项,将"localhost"改为"%"
#MysqL -u root -proot
MysqL>update user set host = '%' where user = 'root';
MysqL>select host,user from user;
MysqL>FLUSH PRIVILEGES;
修改完这些就可以远程访问了。
启动:sudo /etc/init.d/MysqL start
停止:sudo /etc/init.d/MysqL stop
重启:sudo /etc/init.d/MysqL restart