安装数据库
上传mysql安装包到服务器
1.创建目录 mkdir -p /opt/mysql
2.将mysql安装包上传到该目录下 cd /opt/mysql
安装依赖
[root@monitorclient mysql]# yum install libaio
[root@monitorclient mysql]# yum install perl
[root@monitorclient mysql]# yum install net-tools
安装myql5.7
1.解压mysql5.7安装包
[root@monitorclient mysql]# tar -xvf mysql-5.7.27-1.el6.x86_64.rpm-bundle.tar
解压完会有很多rpm文件,是需要安装的
2.安装mysql5.7
[root@monitorclient mysql]#rpm -ivh mysql-community-common-5.7.27-1.el6.x86_64.rpm
[root@monitorclient mysql]#rpm -ivh mysql-community-libs-5.7.27-1.el6.x86_64.rpm
[root@monitorclient mysql]#rpm -ivh mysql-community-client-5.7.27-1.el6.x86_64.rpm
[root@monitorclient mysql]#rpm -ivh mysql-community-server-5.7.27-1.el6.x86_64.rpm
3.查看mysql5.7的状态,没启动的话要把mysql启动
查看状态 [root@monitorclient mysql]#service mysqld status
启 动 [root@monitorclient mysql]#service mysqld start
4.修改密码
查看临时密码:[root@localhost src]# grep password /var/log/mysqld.log
用临时密码登录mysql
[root@localhost src]# mysql -uroot –p
修改成新的密码
mysql> set password = password(“123456”);
5.开启远程连接,允许远程连接数据库
mysql> GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘123456’ WITH GRANT OPTION;
6.防火请开启端口
关闭防火墙
[root@monitorclient mysql]#systemctl stop firewalld