转)Ubuntu安装mysql5.7

时间:2022-06-09 00:27:48

主要参考http://blog.csdn.net/q894523017/article/details/50705392

包去官网下载,解压,安装步骤如下:

上文中有错误,正确如下: 
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-community-client_5.7.10-1ubuntu14.04_amd64.deb 
sudo dpkg -i mysql-client_5.7.10-1ubuntu14.04_amd64.deb 
sudo dpkg -i mysql-common_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

为了远程连接,修改配置文件: 
vim /etc/mysql/mysql.conf.d/mysqld.cnf 
可能不同系统不同,记住找到bind_address这句就行了. 
再改点mysql配置,以超级权限登录后修改.(其他方法参考另一篇文章) 
mysql -u root -proot 
mysql>use mysql; 
mysql>update user set host = '%' where user = 'root'; 
mysql>select host, user from user; 
mysql>FLUSH PRIVILEGES; 
记得重启服务.