我用ubuntu 14.04 最早安装的mysql 5.6.后来经国际友人edward帮助装成mysql 5.5,不过升级5.7 确实比较麻烦
sudo apt-get remove mysql-client-5.5 mysql-server-5.5 # 如果是5.6就把5.5换成5.6
sudo apt-get autoremove
删除5.6
sudo apt-add-repository --remove ppa:ondrej/mysql-5.6
# 如果没有 apt-add-repository 先安装上
# sudo apt-get install software-properties-common
sudo apt-get install software-properties-common
先在 http://dev.mysql.com/downloads/repo/apt/ 下载最新的 deb 文件,然后使用 dpkg 命令添加源,最后执行安装 MySQL 命令即可:
sudo dpkg -i mysql-apt-config_0.8.3-1_all.deb
运行
sudo apt-get update
提示
E: The method driver /usr/lib/apt/methods/https could not be found.
安装apt组件
sudo apt-get install apt-transport-https
运行
sudo apt-get update
sudo apt-get install mysql-server
开始安装mysql 5.7
sudo service mysql start
出现
mysql
No directory, logging in with HOME=/
运行
sudo usermod -d /var/lib/mysql/ mysql
出现
mysql
* MySQL Community Server 5.7.17 did not start. Please check logs for more details.
cd /var/log/mysql/
2017-03-30T06:09:41.711664Z 0 [Warning] System table 'plugin' is expected to be transactional.
2017-03-30T06:09:41.711812Z 0 [ERROR] unknown variable 'thread_concurrency=8'
2017-03-30T06:09:41.711825Z 0 [ERROR] Aborting
运行sudo find / -name my.cnf -print
找到配置文件在 sudo vi /etc/my.cnf
注释掉thread_concurrency=8
li@li-shuangbin:/var/log/mysql$ sudo service mysql start
mysql
...
* MySQL Community Server 5.7.17 is started
表示运行成功
安装完之后还需执行一下 sudo mysql_upgrade -u root -p 更新数据(重要)
mysql_upgrade -u root -p --force
Enter password:
mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) while connecting to the MySQL server
Upgrade process encountered error and will not continue.
我这里不知道为什么没有/tmp/mysql.sock
只好运行
sudo mysql_upgrade -h 127.0.0.1 -u root -p --force
Table 'performance_schema.session_variables' doesn't exist 或者
出现
Native table 'performance_schema'.'session_variables' has the wrong structure
重启mysql
sudo service mysql stop
sudo service mysql start
阅读(2467) | 评论(0) | 转发(0) |