CentOS7_yum在线安装mysql数据库
首先进官网下载yum安装发行包
通过官网查找需要的版本和对应的平台版本https://dev.mysql.com/downloads/repo/yum/。
安装wget命令软件
[[email protected] ~]# yum install wget.x86_64 -y
通过wget命令在线下载源
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum install -y mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server
安装完成后启用服务
systemctl start mysqld.service
查看MySQL运行状态
systemctl status mysqld.service
修改随机密码
首先找到随机密码:
默认有个随机密码: more /var/log/mysql.log
也可以使用grep命令查询密码: grep 'temporary password' /var/log/mysqld.log
1、使用安全插件完成:mysql_secure_installation
2、使用mysqladmin命令完成 mysqladmin -uroot -p'原密码' password'新密码'
3、使用MySQL
登录mysql
[[email protected] ~]# mysql -uroot -p