shell> wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpmmysql
shell> yum localinstall mysql57-community-release-el7-8.noarch.rpmsql
service mysqld start/stop/restartshell
安裝 yum install mariadb-server mariadbvim
啓動 systemctl start mariadbsocket
alter user 'root'@'localhost' identified by 'Guojunwen3201@';ide
必須含有數字,小寫或大寫字母,特殊字符ui
# vim /etc/my.cnf 配置文件spa
在[mysqld]的段中加上一句:skip-grant-tablesrest
例如:code
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-grant-tables
而後能夠不須要密碼進行登陸
登陸並修改MySQL的root密碼 (不要忘記結尾分號)
mysql> USE mysql ; mysql> UPDATE user SET Password = password ( 'new-password' ) WHERE User = 'root' ; mysql> flush privileges ; mysql> quit
若是設置失敗,多是由於新版本中 password 字段改爲了 authentication_string
因此更改語句替換爲
update mysql.user set authentication_string=password('root') where user='root' ;