ubuntu 14.04 mysql 5.7_在 Ubuntu 14.04 下安装 mysql 5.7.10

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

mysql官网上下载mysql-server_5.7.21-1ubuntu14.04_amd64.deb-bundle.tar,然后进行离线安装,解压该安装包,会出现11个依赖包,按照顺序依次使用sudo dpkg -i 进行安装,中间会报错,显示缺少相应的依赖,具体如下: *******@ubuntu:/opt/mysql$ sudo dpkg -i mysql-community-client_5.7.21-1ubuntu14.04_amd64.deb Selecting previously unselected package mysql-community-client. (Reading database ... 208518 files and directories currently installed.) Preparing to unpack mysql-community-client_5.7.21-1ubuntu14.04_amd64.deb ... Unpacking mysql-community-client (5.7.21-1ubuntu14.04) ... dpkg: dependency problems prevent configuration of mysql-community-client: mysql-community-client depends on libaio1 (>= 0.3.93); however: Package libaio1 is not installed. dpkg: error processing package mysql-community-client (--install): dependency problems - leaving unconfigured Processing triggers for man-db (2.6.7.1-1ubuntu1) ... Errors were encountered while processing: mysql-community-client 和 ********@ubuntu:/opt/mysql$ sudo dpkg -i mysql-community-server_5.7.21-1ubuntu14.04_amd64.deb Selecting previously unselected package mysql-community-server. (Reading database ... 208598 files and directories currently installed.) Preparing to unpack mysql-community-server_5.7.21-1ubuntu14.04_amd64.deb ... Unpacking mysql-community-server (5.7.21-1ubuntu14.04) ... dpkg: dependency problems prevent configuration of mysql-community-server: mysql-community-server depends on libmecab2 (>= 0.996-1.1); however: Package libmecab2 is not installed. dpkg: error processing package mysql-community-server (--install): dependency problems - leaving unconfigured Processing triggers for man-db (2.6.7.1-1ubuntu1) ... Processing triggers for ureadahead (0.100.0-16) ... ureadahead will be reprofiled on next reboot Errors were encountered while processing: mysql-community-server 附上依赖包安装顺序: 1.mysql-common_5.7.21-1ubuntu14.04_amd64.deb 2.libmysqlclient20_5.7.21-1ubuntu14.04_amd64.deb 3.libmysqlclient-dev_5.7.21-1ubuntu14.04_amd64.deb 4.libmysqld-dev_5.7.21-1ubuntu14.04_amd64.deb
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值