deepin系统中,默认的系统源,使用apt-get install mysql-server会自动拉取mysql的分支海狮DB,然后无法安装成功mysql5.7正确的版本,LZ在这里也是几经波折,实践了几次(其中包括了deb包安装,apt-get安装,压缩包源码安装,但是效果都不尽人意),最后发现只需要更换系统的apt源即可。
sudo apt purge mysql-*
sudo rm -rf /etc/mysql/ /var/lib/mysql
sudo apt autoremove
sudo vim /etc/apt/sources.list
#删除内容,并添加以下内容:
## Generated by deepin-installer
deb [by-hash=force] https://mirrors.tuna.tsinghua.edu.cn/deepin panda main contrib non-free
sudo apt-get update
和sudo apt-get upgrade
命令。sudo apt-get install mysql-server mysql-client
sudo cat /etc/mysql/debian.cnf
Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
#用户名密码
user = debian-sys-maint
password = VPgo7lfDrISsIP9u
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = VPgo7lfDrISsIP9u
socket = /var/run/mysqld/mysqld.sock
> mysql -u debian-sys-maint -p VPgo7lfDrISsIP9u
> use mysql;
> update user set plugin="mysql_native_password",authentication_string=password('root') where user="root";
> FLUSH PRIVILEGES;
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
# 在mysqld节点,添加以下:
character-set-server = utf8
sudo systemctl restart mysql.service
show variables like 'char%';
得到以下结果:
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
修改成功。
特别说明:
以下所有的演示操作都是在root用户下进行,如果你使用非root用户,则需要在每条命令的前面加上sudo。
例如:
apt-get install libaio1
加上sudo后为 sudo apt-get install libaio1
好了,接下来我一本正经地和大家分享安装流程,请看:
Deepin版本:
Version=15.11 桌面版(基于Debian 9发布)
查看Debian和Deepin版本的命令如下:
cat /etc/debian_version
查看版本信息
进入MySQL5.7安装包下载地址: https://dev.mysql.com/downloads/mysql/5.7.html
选择对应的刷选条件;
选择对应的版本
3. 下载对应的安装包: mysql-server_5.7.28-1debian9_amd64.deb-bundle.tar
下载包
命令为:
命令为:
tar -xvf mysql-server_5.7.30-1debian9_amd64.deb-bundle.tar
命令为:
dpkg-preconfigure mysql-community-server_5.7.30-1debian9_amd64.deb
命令为:
sudo dpkg -i mysql-{common,community-client,client,community-server,server}_*.deb
sudo apt-get -f install
命令为: