]#安裝mysql安裝源
[root@bogon ~
]# yum -y localinstall mysql57-community-release-el7-
11.noarch.rpm
[root@bogon ~
]# yum -y install mysql-community-server
3,啟動mysql服務並設定開機自啟
[root@bogon ~
]# systemctl start mysqld
[root@bogon ~
]# systemctl enable mysqld
[root@bogon ~
]# systemctl daemon-reload
4,修改root登入密碼mysql安裝完成之後,會在/var/log/mysqld.log檔案中給root生成了乙個臨時的預設密碼。
[root@bogon ~
]# cat /var/log/mysqld.log | grep "password"
2020-05
-22t01:54:
46.176727z 1
[note] a temporary password is generated for root@localhost: pw>f_f?+-
6y<
[root@bogon ~
]#
複製此密碼,使用此密碼登入root
[root@bogon~]
# mysql -uroot -p
enter password:
welcome to the mysql monitor. commands end
with
;or \g.
your mysql connection id is
2server version: 5.7
.302000
,2020
, oracle and
/or its affiliates.
all rights reserved.
oracle is a registered trademark of oracle corporation and
/or its
affiliates. other names may be trademarks of their respective
owners.
type
'help;'
or'\h'
for help.
type
'\c'
to clear the current input statement.
mysql>
修改密碼
mysql>
alter
user
'root'@'localhost' identified by '
758521';
error 1819
(hy000): your password does not satisfy the current policy requirements
如果密碼設定太簡單出現以下的提示
解決方法:
首先,修改validate_password_policy引數的值:
mysql>
setglobal validate_password_policy=0;
query ok,
0rows affected (
0.00 sec)
再修改密碼的長度
mysql>
setglobal validate_password_length=1;
query ok,
0rows affected (
0.00 sec)
mysql>
再次執行修改密碼命令就好了
mysql>
alter
user
'root'@'localhost' identified by '
758521';
query ok,
0rows affected (
0.00 sec)
mysql>
5,設定允許遠端登入
mysql>
grant
allprivilegeson*
.*to'root'@'%
' identified by '
758521' with
grant
option
;query ok,
0rows affected,
1 warning (
0.00 sec)
mysql>
CentOS 7 MySQL5 7 密碼處理
忘記密碼處理 忘記mysql的密碼,可按如下5步操作,可重新設定密碼。當然,我喜歡在新安裝資料庫後,用如下方式設定密碼,不用輸入系統自動生成的密碼。mysqladmin uroot p password 123 select user,authentication string,host from ...
Centos7 mysql5 7 遠端登入解決方案
檢視伺服器安全組是否開放3306埠 未開放新增安全組規則,以開放接著一下步 如果是初次登入,未設定密碼,請移步 進行賦權 mysql 5.7 登陸進去mysql終端 use mysql update user set host where user root 使mysql root使用者可以連線上任...
CentOS 7 MySQL5 7日誌配置
1.修改mysql配置檔案 在mysql配置檔案 etc my.cnf 中寫入 root cnetos7 local etc my.cnf general log 1 general log file usr local mysql mysql 5.7.30 log general.log slow...