分类:
版权声明:本文为博主原创文章,未经博主允许不得转载。
1、安装 MysqL
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libaio1
--不要使用下面语句装
sudo groupadd MysqL
cd /usr/local/src
sudo wget MysqL-server_5.7.10-1ubuntu14.04_amd64.deb-bundle.tar
http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-server_5.7.10-1ubuntu14.04_amd64.deb-bundle.tar
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-client_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-testsuite_5.7.10-1ubuntu14.04_amd64.deb
更新设置到最新系统:
apt-get install libaio1
然后分别安装以下的包:
sudo dpkg -i MysqL-common_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 apt-get -f install
此步为了安装依赖包 libmecab2
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以服务形式自启动
2、开启远程访问访问
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
这样改完3306端口就开始监听了,但是MysqL的权限还没有打开ROOT远程登陆
#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