1.Mysql8 Installation
1-1.Install
[root@Lepard ~]# dnf module -y install mysql:8.0 [root@Lepard ~]# vi /etc/my.cnf.d/charset.cnf (Create New) # Set the default character encoding # To handle 4-byte characters such as pictograms, use [utf8mb4] [mysqld] character-set-server = utf8mb4 [client] default-character-set = utf8mb4 [root@Lepard ~]# systemctl enable –now mysql |
1-2.Security measures
[root@Lepard ~]# mysql_secure_installation |
Securing the MySQL server deployment. Connecting to MySQL using a blank password. VALIDATE PASSWORD COMPONENT can be used to test passwords # Enable/disable password quality check There are three levels of password validation policy: LOW Length >= 8 # Select strength if password quality check is enabled. # Set MySQL root password. Re-enter new password:xxxxxxx # Confirm that the password you entered is correct. # Whether or not to delete anonymous users Normally, root should only be allowed to connect from # Whether to disable remote login for the root user. By default, MySQL comes with a database named ‘test’ that # Whether or not to delete the test database – Removing privileges on test database… Reloading the privilege tables will ensure that all changes # Whether to reload privileged information or not All done! |
1-3.Check Mysql startup.
[root@Lepard ~]# mysql -u root -p passwd xxxxxxx ① Database creation mysql> create database test_database; Query OK, 0 rows affected (0.14 sec) ➁Create DB user *Local user mysql> create user ‘testuser’@’localhost’ identified with mysql_native_password by ‘testpass’; Query OK, 0 rows affected (0.14 sec) ➂Setting user rights mysql> grant all on test_database.* to testuser@’localhost’ with grant option; Query OK, 0 rows affected (0.14 sec)④Reflecting authority settings mysql> flush privileges; Query OK, 0 rows affected (0.22 sec) mysql>exit bye |