Install MySQL server on Centos 8 # install mysql-server [root@thermalite ~]# rpm -qa | grep mysql [root@thermalite ~]# dnf install mysql-server Last metadata expiration check: 1:42:40 ago on Sat 12 Jun 2021 08:58:09 AM EDT. Dependencies resolved. ================================================================================================================================================================================================================= Package Architecture Version Repository Size ================================================================================================================================================================================================================= Installing: mysql-server x86_64 8.0.21-1.module_el8.2.0+493+63b41e36 appstream 22 M Installing dependencies: mariadb-connector-c-config noarch 3.1.11-2.el8_3 appstream 15 k mecab x86_64 0.996-1.module_el8.2.0+493+63b41e36.9 appstream 393 k mysql x86_64 8.0.21-1.module_el8.2.0+493+63b41e36 appstream 12 M mysql-common x86_64 8.0.21-1.module_el8.2.0+493+63b41e36 appstream 148 k mysql-errmsg x86_64 8.0.21-1.module_el8.2.0+493+63b41e36 appstream 581 k protobuf-lite x86_64 3.5.0-13.el8 appstream 149 k Enabling module streams: mysql 8.0 Transaction Summary ================================================================================================================================================================================================================= Install 7 Packages Total download size: 35 M Installed size: 182 M Is this ok [y/N]: y Downloading Packages: (1/7): mariadb-connector-c-config-3.1.11-2.el8_3.noarch.rpm 258 kB/s | 15 kB 00:00 (2/7): mysql-common-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64.rpm 3.4 MB/s | 148 kB 00:00 (3/7): mecab-0.996-1.module_el8.2.0+493+63b41e36.9.x86_64.rpm 3.6 MB/s | 393 kB 00:00 (4/7): mysql-errmsg-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64.rpm 5.8 MB/s | 581 kB 00:00 (5/7): protobuf-lite-3.5.0-13.el8.x86_64.rpm 9.4 MB/s | 149 kB 00:00 (6/7): mysql-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64.rpm 23 MB/s | 12 MB 00:00 (7/7): mysql-server-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64.rpm 33 MB/s | 22 MB 00:00 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 36 MB/s | 35 MB 00:00 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : mariadb-connector-c-config-3.1.11-2.el8_3.noarch 1/7 Installing : mysql-common-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64 2/7 Installing : mysql-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64 3/7 Installing : mysql-errmsg-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64 4/7 Installing : protobuf-lite-3.5.0-13.el8.x86_64 5/7 Installing : mecab-0.996-1.module_el8.2.0+493+63b41e36.9.x86_64 6/7 Running scriptlet: mecab-0.996-1.module_el8.2.0+493+63b41e36.9.x86_64 6/7 Running scriptlet: mysql-server-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64 7/7 Installing : mysql-server-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64 7/7 Running scriptlet: mysql-server-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64 7/7 ValueError: File context for /var/log/mysql(/.*)? already defined [/usr/lib/tmpfiles.d/pesign.conf:1] Line references path below legacy directory /var/run/, updating /var/run/pesign → /run/pesign; please update the tmpfiles.d/ drop-in file accordingly. [/usr/lib/tmpfiles.d/postgresql.conf:1] Line references path below legacy directory /var/run/, updating /var/run/postgresql → /run/postgresql; please update the tmpfiles.d/ drop-in file accordingly. Verifying : mariadb-connector-c-config-3.1.11-2.el8_3.noarch 1/7 Verifying : mecab-0.996-1.module_el8.2.0+493+63b41e36.9.x86_64 2/7 Verifying : mysql-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64 3/7 Verifying : mysql-common-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64 4/7 Verifying : mysql-errmsg-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64 5/7 Verifying : mysql-server-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64 6/7 Verifying : protobuf-lite-3.5.0-13.el8.x86_64 7/7 Installed: mariadb-connector-c-config-3.1.11-2.el8_3.noarch mecab-0.996-1.module_el8.2.0+493+63b41e36.9.x86_64 mysql-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64 mysql-common-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64 mysql-errmsg-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64 mysql-server-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64 protobuf-lite-3.5.0-13.el8.x86_64 Complete! [root@thermalite ~]# # setup the mysql service [root@thermalite ~]# systemctl start mysqld.service [root@thermalite ~]# systemctl status mysqld.service ● mysqld.service - MySQL 8.0 database server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled) Active: active (running) since Sat 2021-06-12 10:42:47 EDT; 5s ago Process: 1429927 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS) Process: 1429800 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS) Process: 1429775 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS) Main PID: 1429883 (mysqld) Status: "Server is operational" Tasks: 39 (limit: 49085) Memory: 428.1M CGroup: /system.slice/mysqld.service └─1429883 /usr/libexec/mysqld --basedir=/usr Jun 12 10:42:12 thermalite.localdomain systemd[1]: Starting MySQL 8.0 database server... Jun 12 10:42:12 thermalite.localdomain mysql-prepare-db-dir[1429800]: Initializing MySQL database Jun 12 10:42:47 thermalite.localdomain systemd[1]: Started MySQL 8.0 database server. [root@thermalite ~]# systemctl restart mysqld.service [root@thermalite ~]# systemctl status mysqld.service ● mysqld.service - MySQL 8.0 database server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled) Active: active (running) since Sat 2021-06-12 10:43:06 EDT; 3s ago Process: 1429965 ExecStopPost=/usr/libexec/mysql-wait-stop (code=exited, status=0/SUCCESS) Process: 1430100 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS) Process: 1430019 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS) Process: 1429992 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS) Main PID: 1430056 (mysqld) Status: "Server is operational" Tasks: 39 (limit: 49085) Memory: 335.1M CGroup: /system.slice/mysqld.service └─1430056 /usr/libexec/mysqld --basedir=/usr Jun 12 10:43:05 thermalite.localdomain systemd[1]: Starting MySQL 8.0 database server... Jun 12 10:43:06 thermalite.localdomain systemd[1]: Started MySQL 8.0 database server. [root@thermalite ~]# systemctl enable mysqld Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service. [root@thermalite ~]# # configure the firewall setting [root@thermalite ~]# sudo firewall-cmd --add-service=mysql --permanent success [root@thermalite ~]# sudo firewall-cmd --reload success # Verify the changes with the ss utility: [root@thermalite ~]# ss -nlt | grep 3306 LISTEN 0 128 0.0.0.0:3306 0.0.0.0:* LISTEN 0 70 *:33060 *:* [root@thermalite ~]# # setup the Oracle SQL Developer Connection Name: thermalitedb Username: dbuser Password: my_mysql_password Hostname: 10.10.1.80 Port: 3306 # secure the mysql installation [root@thermalite ~]# mysql_secure_installation Securing the MySQL server deployment. Connecting to MySQL using a blank password. VALIDATE PASSWORD COMPONENT can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD component? Press y|Y for Yes, any other key for No: y There are three levels of password validation policy: LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2 Please set the password for root here. New password: my_very_hard_password Re-enter new password: my_very_hard_password Estimated strength of the password: 100 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : y Success. Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y Success. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : n ... skipping. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y Success. All done! [root@thermalite ~]# exit logout # check installation [malex@thermalite ~]$ mysqladmin -u root -p version Enter password: mysqladmin Ver 8.0.21 for Linux on x86_64 (Source distribution) Copyright (c) 2000, 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. Server version 8.0.21 Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/lib/mysql/mysql.sock Uptime: 5 min 7 sec Threads: 2 Questions: 12 Slow queries: 0 Opens: 127 Flush tables: 3 Open tables: 48 Queries per second avg: 0.039 [malex@thermalite ~]$ # setup the user and the database access [malex@thermalite ~]$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 11 Server version: 8.0.21 Source distribution Copyright (c) 2000, 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> CREATE USER 'dbuser'@'%' IDENTIFIED BY 'my_mysql_password'; Query OK, 0 rows affected (0.04 sec) mysql> create database thermalitedb; Query OK, 1 row affected (0.05 sec) mysql> grant all on thermalitedb.* to 'dbuser'@'%'; Query OK, 0 rows affected (0.03 sec) mysql>
Saturday, June 12, 2021
Install MySQL server on Centos 8
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment