1首先下载mysql安装包 mysql-server_5.7.20-1ubuntu14.04_amd64.deb-bundle.tar
然后解压 sudo tar -xzvf mysql-server_5.7.20-1ubuntu14.04_amd64.deb-bundle.tar
在命令行终端切换到安装包所在目录
cd /home/zcgl/AssetManagerNecessary/Mysql5.7.20
然后更新一下源
sudo apt-get update
2 sudo dpkg -i mysql-common_5.7.20-1ubuntu14.04_amd64.deb
3 sudo dpkg -i libmysqlclient20_5.7.20-1ubuntu14.04_amd64.deb
4 sudo dpkg -i libmysqlclient-dev_5.7.20-1ubuntu14.04_amd64.deb
5 sudo apt-get install libaio1
6 sudo dpkg -i mysql-community-client_5.7.20-1ubuntu14.04_amd64.deb
7 sudo dpkg -i mysql-client_5.7.20-1ubuntu14.04_amd64.deb
sudo apt-get install libmecab2
8 sudo dpkg -i mysql-community-server_5.7.20-1ubuntu14.04_amd64.deb
9 sudo dpkg -i mysql-server_5.7.20-1ubuntu14.04_amd64.deb
10 sudo dpkg -i mysql-community-source_5.7.20-1ubuntu14.04_amd64.deb
11 sudo dpkg -i mysql-community-test_5.7.20-1ubuntu14.04_amd64.deb
12 sudo dpkg -i mysql-testsuite_5.7.20-1ubuntu14.04_amd64.deb
mysql 初始用户:root 安装mysql-community-server时输入了密码123456.
13 登录数据库
mysql -u root -p 123456 -h localhost
14 创建新用户
create user 'monitor'@'%' identified by '1055396245';
15 刷新授权
grant all privileges on *.* to 'monitor'@'%' identified by '1055396245';
flush privileges;
16 退出数据库
exit
17 停止数据库
sudo service mysql stop
18 修改mysql数据库的字符编码为utf-8
sudo nano /etc/mysql/my.cnf
在my.cnf中添加
[mysql]
default-character-set=utf8
[mysqld]
character-set-server=utf8
19 修改数据库允许外网访问
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
注释
#bind-address = 127.0.0.1
20 重启数据库
sudo service mysql start
21 查看3306端口是否开启,若开启,则启动成功
nestat -tln