[root@k8s1 opt]# ll
total 96504
-rw-rw-rw- 1 root root 26712872 Dec 21 22:02
mysql-community-client-8.0.14-1.el7.x86_64.rpm
-rw-rw-rw- 1 root root 579516 Dec 21 22:02
mysql-community-common-8.0.14-1.el7.x86_64.rpm
-rw-rw-rw- 1 root root 2315532 Dec 21 22:03
mysql-community-libs-8.0.14-1.el7.x86_64.rpm
-rw-rw-rw- 1 root root 2160744 Dec 21 22:03
mysql-community-libs-compat-8.0.14-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 37102212 Feb 11 15:57
mysql-community-server-8.0.14-1.el7.x86_64.rpm
drwxr-xr-x. 2 root root 6 Mar 26 2015 rh
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# ll
total 293112
-rw-rw-rw- 1 root root 26712872 Dec 21 22:02
mysql-community-client-8.0.14-1.el7.x86_64.rpm
-rw-rw-rw- 1 root root 579516 Dec 21 22:02
mysql-community-common-8.0.14-1.el7.x86_64.rpm
-rw-rw-rw- 1 root root 2315532 Dec 21 22:03
mysql-community-libs-8.0.14-1.el7.x86_64.rpm
-rw-rw-rw- 1 root root 2160744 Dec 21 22:03
mysql-community-libs-compat-8.0.14-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 162313998 Feb 11
15:58 mysql-community-server-8.0.14-1.el7.x86_64.rpm
drwxr-xr-x. 2 root root 6 Mar
26 2015 rh
[root@k8s1 opt]#
[root@k8s1 opt]# rpm -qa |grep mari
mariadb-libs-5.5.44-2.el7.centos.x86_64
marisa-0.2.4-3.el7.x86_64
[root@k8s1 opt]#
You have new mail in /var/spool/mail/root
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# rpm -ivh
mysql-community-common-8.0.14-1.el7.x86_64.rpm
warning: mysql-community-common-8.0.14-1.el7.x86_64.rpm:
Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-common-8.0.14-1.e#################################
[100%]
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# rpm -ivh
mysql-community-libs-8.0.14-1.el7.x86_64.rpm
warning: mysql-community-libs-8.0.14-1.el7.x86_64.rpm: Header
V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
mariadb-libs is obsoleted by
mysql-community-libs-8.0.14-1.el7.x86_64
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# rpm -e mariadb-libs
error: Failed dependencies:
libmysqlclient.so.18()(64bit) is needed by
(installed) postfix-2:2.10.1-6.el7.x86_64
libmysqlclient.so.18(libmysqlclient_18)(64bit)
is needed by (installed) postfix-2:2.10.1-6.el7.x86_64
[root@k8s1 opt]#
[root@k8s1 opt]# rpm -e mariadb-libs --nodeps
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# rpm -ivh
mysql-community-libs-8.0.14-1.el7.x86_64.rpm
warning: mysql-community-libs-8.0.14-1.el7.x86_64.rpm: Header
V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-libs-8.0.14-1.el7#################################
[100%]
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# rpm -ivh
mysql-community-client-8.0.14-1.el7.x86_64.rpm
warning: mysql-community-client-8.0.14-1.el7.x86_64.rpm:
Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-client-8.0.14-1.e#################################
[100%]
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# rpm -ivh
mysql-community-server-8.0.14-1.el7.x86_64.rpm
warning: mysql-community-server-8.0.14-1.el7.x86_64.rpm:
Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-server-8.0.14-1.e#################################
[100%]
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# systemctl status mysqld
mysqld.service - MySQL Server
Loaded: loaded
(/usr/lib/systemd/system/mysqld.service; enabled; vendor preset:
disabled)
Active: inactive
(dead)
Docs:
man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# ll /var/log/mysql*
-rw-r--r-- 1 mysql mysql 0 Feb 11 16:10
/var/log/mysqld.log
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# cat /var/log/mysql*|grep
passwd
[root@k8s1 opt]# cat /var/log/mysql*|grep
password
[root@k8s1 opt]# cat /var/log/mysqld.log
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# tail -f /var/log/mysqld.log
2019-02-11T08:23:42.014807Z 0 [System] [MY-013169] [Server]
/usr/sbin/mysqld (mysqld 8.0.14) initializing of server in progress
as process 20640
2019-02-11T08:24:07.598733Z 5 [Note] [MY-010454] [Server] A
temporary password is generated for root@localhost:
l!9yywQ7lqjw
2019-02-11T08:24:39.753862Z 0 [System] [MY-013170] [Server]
/usr/sbin/mysqld (mysqld 8.0.14) initializing of server has
completed
2019-02-11T08:24:47.710202Z 0 [System] [MY-010116] [Server]
/usr/sbin/mysqld (mysqld 8.0.14) starting as process 20767
2019-02-11T08:24:53.826736Z 0 [Warning] [MY-010068] [Server]
CA certificate ca.pem is self signed.
2019-02-11T08:24:54.110421Z 0 [System] [MY-010931] [Server]
/usr/sbin/mysqld: ready for connections. Version:
'8.0.14' socket:
'/var/lib/mysql/mysql.sock' port:
3306 MySQL Community Server - GPL.
2019-02-11T08:24:54.589516Z 0 [System] [MY-011323] [Server] X
Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock'
bind-address: '::' port: 33060
^C
[root@k8s1 opt]# cat /var/log/mysql*|grep
password
2019-02-11T08:24:07.598733Z 5 [Note] [MY-010454] [Server] A
temporary password is generated for root@localhost:
l!9yywQ7lqjw
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# mysql -uroot -pwetwt
mysql: [Warning] Using a password on the command line
interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost'
(using password: YES)
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#cat /etc/my.cnf
# For advice on how to change settings please see
#
http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most
important data
# cache in MySQL. Start at 70% of total RAM for dedicated
server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is
enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting
servers.
# The server defaults are faster for transactions and fast
SELECTs.
# Adjust sizes as needed, experiment to find the optimal
values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#
# Remove leading # to revert to previous value for
default_authentication_plugin,
# this will increase compatibility with older clients. For
background, see:
#
https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysqld.log
skip-grant-tables=1
[root@k8s1 opt]#
[root@k8s1 opt]# systemctl restart mysqld
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# cat /var/log/mysqld.log
2019-02-11T08:23:42.014807Z 0 [System] [MY-013169] [Server]
/usr/sbin/mysqld (mysqld 8.0.14) initializing of server in progress
as process 20640
2019-02-11T08:24:07.598733Z 5 [Note] [MY-010454] [Server] A
temporary password is generated for root@localhost:
l!9yywQ7lqjw
2019-02-11T08:24:39.753862Z 0 [System] [MY-013170] [Server]
/usr/sbin/mysqld (mysqld 8.0.14) initializing of server has
completed
2019-02-11T08:24:47.710202Z 0 [System] [MY-010116] [Server]
/usr/sbin/mysqld (mysqld 8.0.14) starting as process 20767
2019-02-11T08:24:53.826736Z 0 [Warning] [MY-010068] [Server]
CA certificate ca.pem is self signed.
2019-02-11T08:24:54.110421Z 0 [System] [MY-010931] [Server]
/usr/sbin/mysqld: ready for connections. Version:
'8.0.14' socket:
'/var/lib/mysql/mysql.sock' port:
3306 MySQL Community Server - GPL.
2019-02-11T08:24:54.589516Z 0 [System] [MY-011323] [Server] X
Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock'
bind-address: '::' port: 33060
2019-02-11T08:27:21.811951Z 0 [System] [MY-010910] [Server]
/usr/sbin/mysqld: Shutdown complete (mysqld
8.0.14) MySQL Community Server - GPL.
2019-02-11T08:27:34.725966Z 0 [System] [MY-010116] [Server]
/usr/sbin/mysqld (mysqld 8.0.14) starting as process 21074
2019-02-11T08:27:41.247382Z 0 [Warning] [MY-010068] [Server]
CA certificate ca.pem is self signed.
2019-02-11T08:27:41.480573Z 0 [System] [MY-010931] [Server]
/usr/sbin/mysqld: ready for connections. Version:
'8.0.14' socket:
'/var/lib/mysql/mysql.sock' port:
0 MySQL Community Server - GPL.
2019-02-11T08:27:41.741157Z 0 [System] [MY-011323] [Server] X
Plugin ready for connections. Socket:
'/var/run/mysqld/mysqlx.sock'
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end
with ; or \g.
Your MySQL connection id is 7
Server version: 8.0.14 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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> exit
Bye
[root@k8s1 opt]# mysql -uroot
Welcome to the MySQL monitor. Commands end
with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.14 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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>
mysql> select user,host from mysql.user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| mysql.infoschema | localhost |
| mysql.session |
localhost |
| mysql.sys | localhost |
| root | localhost |
+------------------+-----------+
4 rows in set (0.10 sec)
mysql>
mysql> update mysql.user set
host='%';
Query OK, 4 rows affected (0.06 sec)
Rows matched: 4 Changed: 4 Warnings: 0
mysql> commit;
Query OK, 0 rows affected (0.01 sec)
mysql> ALTER USER root@'%' IDENTIFIED BY 'root123' ;
ERROR 1290 (HY000): The MySQL server is running with the
--skip-grant-tables option so it cannot execute this
statement
mysql>
mysql> ALTER USER root@'%' IDENTIFIED BY 'root123' ;
ERROR 1290 (HY000): The MySQL server is running with the
--skip-grant-tables option so it cannot execute this
statement
mysql>
mysql>
mysql> flush privileges;
Query OK, 0 rows affected (0.25 sec)
mysql>
mysql> ALTER USER root@'%' IDENTIFIED BY 'root123' ;
ERROR 1819 (HY000): Your password does not satisfy the current
policy requirements
mysql>
mysql> ALTER USER root@'%' IDENTIFIED BY 'root123!!' ;
ERROR 1819 (HY000): Your password does not satisfy the current
policy requirements
mysql>
mysql> ALTER USER root@'%' IDENTIFIED BY 'rooT123!!';
Query OK, 0 rows affected (0.06 sec)
mysql>
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql>
mysql> flush privileges;
Query OK, 0 rows affected (0.09 sec)
mysql>
mysql>
mysql> exit
Bye
[root@k8s1 opt]# mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'@'localhost'
(using password: NO)
[root@k8s1 opt]# mysql -uroot -prooT123!!
mysql -uroot -prooT123mysql
-uroot
mysql: [Warning] Using a password on the command line
interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost'
(using password: YES)
[root@k8s1 opt]#
[root@k8s1 opt]# mysql -uroot -prooT123!!
mysql -uroot -prooT123mysql
-uroot -prooT123mysql
-uroot
mysql: [Warning] Using a password on the command line
interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost'
(using password: YES)
[root@k8s1 opt]# mysql -uroot -prooT123!!
mysql -uroot -prooT123mysql
-uroot -prooT123mysql -uroot -prooT123mysql -uroot
mysql: [Warning] Using a password on the command line
interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost'
(using password: YES)
[root@k8s1 opt]#
[root@k8s1 opt]# mysql -uroot -prooT123!!
mysql -uroot -prooT123mysql
-uroot -prooT123mysql -uroot -prooT123mysql -uroot -prooT123mysql
-uroot
mysql: [Warning] Using a password on the command line
interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost'
(using password: YES)
[root@k8s1 opt]#
[root@k8s1 opt]# mysql -uroot -prooT123mysql
-uroot -prooT123mysql -uroot -prooT123mysql -uroot -prooT123mysql
-uroot
mysql: [Warning] Using a password on the command line
interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost'
(using password: YES)
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost'
(using password: YES)
[root@k8s1 opt]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end
with ; or \g.
Your MySQL connection id is 16
Server version: 8.0.14 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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>
mysql> exit
Bye
[root@k8s1 opt]# mysql -uroot -p"rooT123!!"
mysql -uroot -p"rooT123mysql -uroot
-p"
mysql: [Warning] Using a password on the command line
interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost'
(using password: YES)
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# vi /etc/my.cnf
# For advice on how to change settings please see
#
http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most
important data
# cache in MySQL. Start at 70% of total RAM for dedicated
server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is
enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting
servers.
# The server defaults are faster for transactions and fast
SELECTs.
# Adjust sizes as needed, experiment to find the optimal
values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#
# Remove leading # to revert to previous value for
default_authentication_plugin,
# this will increase compatibility with older clients. For
background, see:
#
https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
#skip-grant-tables=1
~
~
~
[root@k8s1 opt]#
[root@k8s1 opt]# cat /etc/my.cnf
# For advice on how to change settings please see
#
http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most
important data
# cache in MySQL. Start at 70% of total RAM for dedicated
server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is
enabled by
# default. It''s default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting
servers.
# The server defaults are faster for transactions and fast
SELECTs.
# Adjust sizes as needed, experiment to find the optimal
values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#
# Remove leading # to revert to previous value for
default_authentication_plugin,
# this will increase compatibility with older clients. For
background, see:
#
https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
#skip-grant-tables=1
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# systemctl restart mysqld
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# mysql -uroot -p"rooT123!!"
mysql -uroot -p"rooT123systemctl
restart mysqld"
mysql: [Warning] Using a password on the command line
interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost'
(using password: YES)
[root@k8s1 opt]# mysql -uroot -prooT123!!
mysql -uroot -prooT123mysql
-uroot -p"rooT123systemctl
restart mysqld"
mysql: [Warning] Using a password on the command line
interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost'
(using password: YES)
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end
with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.14 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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> use mysql
Reading table information for completion of table and column
names
You can turn off this feature to get a quicker startup with
-A
Database changed
mysql>
mysql>
mysql>
mysql> select user,host from user;
+------------------+------+
| user | host |
+------------------+------+
| mysql.infoschema | % |
| mysql.session |
% |
| mysql.sys | % |
| root | % |
+------------------+------+
4 rows in set (0.01 sec)
mysql> exit
Bye
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# mysql
-uroot -prooT123!!
mysql -uroot -prooT123mysql -uroot -p
mysql: [Warning] Using a password on the command line
interface can be insecure.
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost'
(using password: NO)
[root@k8s1 opt]# mysql -uroot -p"rooT123!!"
mysql -uroot -p"rooT123 mysql
-uroot -prooT123mysql -uroot -p"
mysql: [Warning] Using a password on the command line
interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost'
(using password: YES)
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end
with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.14 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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> use mysql
Reading table information for completion of table and column
names
You can turn off this feature to get a quicker startup with
-A
Database changed
mysql>
mysql>
mysql> ALTER USER root@'%' IDENTIFIED BY "Root123!!";
Query OK, 0 rows affected (0.06 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.04 sec)
mysql>
mysql>
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql>
mysql> exit
Bye
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end
with ; or \g.
Your MySQL connection id is 15
Server version: 8.0.14 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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>
mysql> use mysql
Reading table information for completion of table and column
names
You can turn off this feature to get a quicker startup with
-A
Database changed
mysql>
mysql>
mysql> update user set host='%';
Query OK, 0 rows affected (0.05 sec)
Rows matched: 4 Changed: 0 Warnings: 0
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql>
mysql> flush privileges;
Query OK, 0 rows affected (0.05 sec)
mysql>
mysql> exit;
Bye
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end
with ; or \g.
Your MySQL connection id is 18
Server version: 8.0.14 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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>
mysql> ALTER USER root@'%' IDENTIFIED BY "root123" ;
ERROR 1819 (HY000): Your password does not satisfy the current
policy requirements
mysql>
mysql>
mysql> ALTER USER root@'%' IDENTIFIED BY "root123A!" ;
Query OK, 0 rows affected (0.07 sec)
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.04 sec)
mysql>
mysql>
mysql> ALTER USER 'root'@'%' IDENTIFIED
WITH mysql_native_password BY 'Root123!!' ;
Query OK, 0 rows affected (0.21 sec)
mysql> ALTER USER 'root'@'%' IDENTIFIED
WITH mysql_native_password BY 'Root123!' ;
Query OK, 0 rows affected (0.18 sec)
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)
mysql>
mysql>
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH
mysql_native_password BY "Root123!" ;
commit;
flush privileges;Query OK, 0 rows affected (0.15 sec)
mysql>
mysql> commit;
Query OK, 0 rows affected (0.01 sec)
mysql>
mysql> flush privileges;
Query OK, 0 rows affected (0.15 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.24 sec)
mysql>
mysql>
mysql> ALTER USER root@'%' IDENTIFIED BY "Root123!" ;
commit;
Query OK, 0 rows affected (0.03 sec)
mysql>
mysql> commit;
flush privileges;Query OK, 0 rows affected (0.01 sec)
mysql>
mysql> flush privileges;
Query OK, 0 rows affected (0.07 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)
mysql>
mysql>
mysql> exit
Bye
[root@k8s1 opt]#
[root@k8s1 opt]# mysql -uroot -pRoot123!
mysql: [Warning] Using a password on the command line
interface can be insecure.
Welcome to the MySQL monitor. Commands end
with ; or \g.
Your MySQL connection id is 36
Server version: 8.0.14 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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> exit
Bye
[root@k8s1 opt]#
[root@k8s1 opt]# mysql -uroot -p'Root123!'
mysql: [Warning] Using a password on the command line
interface can be insecure.
Welcome to the MySQL monitor. Commands end
with ; or \g.
Your MySQL connection id is 37
Server version: 8.0.14 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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> exit
Bye
[root@k8s1 opt]# mysql -uroot -p"Root123!"
-bash: !"": event not found
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]#
[root@k8s1 opt]# mysql -uroot -pRoot123!
mysql: [Warning] Using a password on the command line
interface can be insecure.
Welcome to the MySQL monitor. Commands end
with ; or \g.
Your MySQL connection id is 38
Server version: 8.0.14 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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>
mysql> ALTER USER root@'%' IDENTIFIED BY 'Root123!' ;
commit;
flush privileges;Query OK, 0 rows affected (0.17 sec)
mysql>
mysql> commit;
Query OK, 0 rows affected (0.13 sec)
mysql>
mysql> flush privileges;
Query OK, 0 rows affected (0.03 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.17 sec)
mysql> exit
Bye
###############################################################
简单总结
###############################################################
单引号、双引号改密码都可以,效果相同,
登陆的时候三种情况:
只有-p后面双引号无法登陆,原因不明
##教训:密码里面尽量不要用!号,可以是圆点号或逗号
、、、
=============
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY
'Root123!' ;
commit;
flush privileges;
、、、
=============
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY
"Root123!" ;
commit;
flush privileges;
、、、
=============
ALTER USER root@'%'
IDENTIFIED BY "Root123!" ;
commit;
flush privileges;
、、、
=============
ALTER USER root@'%'
IDENTIFIED BY 'Root123!' ;
commit;
flush privileges;
、、、
===================
下面三种只有带双引号的方式无法登陆
原因不明
mysql -uroot -p'Root123!'
mysql -uroot -pRoot123!
mysql -uroot -p"Root123!"
[root@k8s1 ~]# mysql -uroot -p"Root123!"
-bash: !": event not found
[root@k8s1 ~]#
[root@k8s1 ~]# mysql -uroot -p"Root123!"
-bash: !": event not found
[root@k8s1 ~]#
[root@k8s1 ~]#
[root@k8s1 ~]#
[root@k8s1 ~]#
[root@k8s1 ~]# mysql -uroot -pRoot123!
mysql: [Warning] Using a password on the command line
interface can be insecure.
Welcome to the MySQL monitor. Commands end
with ; or \g.
Your MySQL connection id is 42
Server version: 8.0.14 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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 -uroot -p"Root!123"
mysql -uroot -p'Root!123'
mysql -uroot -pRoot!123
、、、
=============
ALTER USER root@'%'
IDENTIFIED WITH
mysql_native_password BY "Root.123" ;
commit;
flush privileges;
[root@k8s1 ~]# mysql -uroot -p'Root.123'
mysql: [Warning] Using a password on the command line
interface can be insecure.
Welcome to the MySQL monitor. Commands end
with ; or \g.
Your MySQL connection id is 52
Server version: 8.0.14 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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> exit
Bye
[root@k8s1 ~]#
[root@k8s1 ~]# mysql -uroot -pRoot.123
mysql: [Warning] Using a password on the command line
interface can be insecure.
Welcome to the MySQL monitor. Commands end
with ; or \g.
Your MySQL connection id is 53
Server version: 8.0.14 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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> exit
Bye
[root@k8s1 ~]#
[root@k8s1 ~]# mysql -uroot -p"Root.123"
mysql: [Warning] Using a password on the command line
interface can be insecure.
Welcome to the MySQL monitor. Commands end
with ; or \g.
Your MySQL connection id is 54
Server version: 8.0.14 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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>
mysql>
mysql> exit
Bye
[root@k8s1 ~]#
[root@k8s1 ~]#
、、、
=============
ALTER USER root@'%'
IDENTIFIED WITH
mysql_native_password BY "Root,123" ;
commit;
flush privileges;
mysql -uroot -p"Root,123"
mysql -uroot -p'Root,123'
mysql -uroot -pRoot,123
[root@k8s1 ~]#
[root@k8s1 ~]#
[root@k8s1 ~]# mysql -uroot -p"Root,123"
mysql: [Warning] Using a password on the command line
interface can be insecure.
Welcome to the MySQL monitor. Commands end
with ; or \g.
Your MySQL connection id is 55
Server version: 8.0.14 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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> exit
Bye
[root@k8s1 ~]#
[root@k8s1 ~]# mysql -uroot -p'Root,123'
mysql: [Warning] Using a password on the command line
interface can be insecure.
Welcome to the MySQL monitor. Commands end
with ; or \g.
Your MySQL connection id is 56
Server version: 8.0.14 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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> exit
Bye
[root@k8s1 ~]# mysql -uroot -pRoot,123
mysql: [Warning] Using a password on the command line
interface can be insecure.
Welcome to the MySQL monitor. Commands end
with ; or \g.
Your MySQL connection id is 57
Server version: 8.0.14 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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> exit
Bye
[root@k8s1 ~]
、、、
=============
flush privileges;
ALTER USER root@'%'
IDENTIFIED WITH
mysql_native_password BY "Root123." ;
commit;
flush privileges;
、、、MySQL8.0不知道密码情况下重置用户密码步骤
====================================================
第一个flush privileges; 很重要,没有无法成功;
skip-grant-tables=1
flush privileges;
ALTER USER root@'%'
IDENTIFIED BY 'root1234!' ;
flush privileges;
[root@k8s2 ~]#
[root@k8s2 ~]# mysql -uroot
Welcome to the MySQL monitor. Commands end
with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.24 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, 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> use mysql
Reading table information for completion of table and column
names
You can turn off this feature to get a quicker startup with
-A
Database changed
mysql> ALTER USER root@'%' IDENTIFIED BY 'root1234!' ;
ERROR 1290 (HY000): The MySQL server is running with the
--skip-grant-tables option so it cannot execute this
statement
mysql>
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> ALTER USER root@'%' IDENTIFIED BY 'root1234!' ;
Query OK, 0 rows affected (0.00 sec)
mysql>