1.下载Mysql
根据操作系统选择对应版本,下载完成后上传安装服务器https://dev.mysql.com/downloads/mysql/
- 解压
[root@iZ2ze6x9yc8dbln1yj6rurZ softpackage]# tar -xvf mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar
2.安装
详细的安装文档可参考https://dev.mysql.com/doc/refman/5.7/en/linux-installation-rpm.html
- 本地安装
[root@iZ2ze6x9yc8dbln1yj6rurZ softpackage]# yum localinstall mysql-community-{server,client,common,libs,devel,libs-compat}-5.7*
- 启动Mysql
[root@iZ2ze6x9yc8dbln1yj6rurZ softpackage]# yum install -y mariadb-server
[root@iZ2ze6x9yc8dbln1yj6rurZ softpackage]# systemctl start mysql.mysqld.service
3.配置Mysql
- 查看临时密码
[root@iZ2ze6x9yc8dbln1yj6rurZ softpackage]# grep 'temporary password' /var/log/mysqld.log
2018-01-24T16:19:32.257978Z 1 [Note] A temporary password is generated for root@localhost: dMw8js_feZtZ
连接数据库
[root@iZ2ze6x9yc8dbln1yj6rurZ softpackage]# mysql -uroot -p输入临时密码
设置mysql密码:
mysql> set password = password('你的密码')
-
查看mysql用户
mysql> select host,user from user;
-
配置远程登录
mysql> grant all privileges on *.* to 'root'@'%' identified by '你的密码' with grant option;
mysql> flush privileges;
测试本地连接
[root@iZ2ze6x9yc8dbln1yj6rurZ softpackage]# mysql -uroot -p密码
-
阿里云开放端口
开放防火墙端口
[root@iZ2ze6x9yc8dbln1yj6rurZ softpackage]# firewall-cmd --zone=public --add-port=3306/tcp --permanent
-
配置远程客户端
创建mysql用户
- 其他资料
MySql WorkBench
https://www.jianshu.com/p/748a7c07d511
mysql数据类型
http://www.jb51.net/article/20555.htm