安装MYSQL
下载mysql
bash
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-server
注意这里下包名称里面的el7代表centos7,centos8同理则是el8
权限设置:
bash
chown -R mysql:mysql /var/lib/mysql/
初始化 MySQL:
bash
mysqld --initialize
启动 MySQL服务:
bash
systemctl start mysqld
查看版本
bash
mysqladmin --version
连接mysql
bash
mysql
bash
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
修改密码
bash
mysql> use mysql;
mysql> update user set password=PASSWORD("password") where user="root";
mysql> FLUSH PRIVILEGES;
重新进入
bash
mysql -u root -p
输入密码后,就可以了。