1:
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
rpm -ivh mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server
2: 查看mysql版本
### 查看MySQL版本
```
yum list installed | grep "mysql"
```
### 卸载Yum Repository
```
yum -y remove mysql57-community-release-el7-10.noarch.rpm
3:
### 启动MySQL
```
service mysqld start
```
### 查看MySQL安装后临时密码
```
grep "temporary password" /var/log/mysqld.log
```
### 通过上述临时密码登录MySQL
```
mysql -u root -p
```
### 登录后更改root登录密码
```
mysql>
mysql> alter user 'root'@'localhost' identified by '密码';
Query OK, 0 rows affected (0.00 sec)
mysql>
```
## 修改MySQL数据存储路径到其他文件夹
```
[root@business-mysql-master ~]# cat /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
4: 把修改好的my.cnf放到etc下:
service mysqld stop
mv /var/lib/mysql /data/
5:
[ERROR] Can't find error-message file '/opt/mysql/share/mysql/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive
find / -name errmsg.sys
[ERROR] --initialize specified but the data directory has files in it. Aborting.
应该是配置文件的错误导致数据文件错误,找到原因是mysqld在
自动启动,当删除data下的文件后,启动之后又有了
To force a start use "systemctl reset-failed mysqld.service" followed by "systemctl start mysqld.service" again.
1: 安装包
2: 直接替换/etc/my.cnf
3: service mysqld start
一直报错:
是因为配置文件有错误