Contents
MySQL8
①Install
|
1 |
# dnf install community-mysql-server |
➁Start MySQL server
|
1 |
# systemctl start mysqld |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# systemctl status mysqld ● mysqld.service - MySQL 8.4 database server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; preset: disabled) Drop-In: /usr/lib/systemd/system/service.d └─10-timeout-abort.conf Active: active (running) since Mon 2025-11-03 16:31:17 JST; 10s ago Invocation: 35983ce002e84da4a9fa81ecb45bd60f Process: 2390 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS) Process: 2412 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCES> Main PID: 2487 (mysqld) Status: "Server is operational" Tasks: 35 (limit: 4532) Memory: 431.5M (peak: 444.3M) CPU: 2.647s CGroup: /system.slice/mysqld.service └─2487 /usr/libexec/mysqld --basedir=/usr Nov 03 16:31:13 Lepard systemd[1]: Starting mysqld.service - MySQL 8.4 database server... Nov 03 16:31:13 Lepard mysql-prepare-db-dir[2412]: Initializing MySQL database Nov 03 16:31:17 Lepard systemd[1]: Started mysqld.service - MySQL 8.4 database server. |
➂Check mysql version
|
1 2 |
# mysql -V mysql Ver 8.4.6 for Linux on x86_64 (Source distribution) |
④Connect to the MySQL server and change the root user password
|
1 2 3 |
# mysql mysql> alter user 'root'@'localhost' identified by 'password'; |
⑤Set basic policies
Use the "mysql_secure_installation" command to set the root user password and set some basic policies
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# mysql_secure_installation Securing the MySQL server deployment. Enter password for user root: 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? # Enable/disable password quality check 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 # Select strength if password quality check is enabled Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 ←May be optional for each Using existing password for root. # Set MySQL root password Estimated strength of the password: 100 Change the password for root ? ((Press y|Y for Yes, any other key for No) : y New password: ← Any password Re-enter new password: ← Same password again # Confirmation that the password you entered is correct 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. # Whether to remove anonymous users or not 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. # Disable/enable remote login for root user 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. # Whether to delete the test database or not Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y - Dropping test database... Success. - Removing privileges on test database... Success. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. # Whether to reload privilege information or not Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y Success. All done! |
From now on, use the following command to connect to mysql
|
1 |
# mysql -u root -p |
WordPress
1. Create database for Word Press
For example, let's say the database is [wp_db], the database user is [wp_user], and the password is [?Wabcd123].
However, starting with MySQL 8.4, mysql_native_password is disabled, so edit my.cnf to enable its use.
Open my.cnf and append the following:
|
1 2 3 4 5 |
# vi /etc/my.cnf Add the following: [mysqld] mysql_native_password=on |
Restart MySQL
|
1 |
# systemctl restart mysqld |
Create a user and database
# 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.40 Source distribution
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
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 DATABASE wp_db DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Query OK, 1 row affected, 2 warnings (0.00 sec)
mysql> CREATE USER 'wp_user'@'localhost' IDENTIFIED WITH mysql_native_password BY '?Wwabcd123';
Query OK, 0 rows affected (0.01 sec)
mysql> GRANT ALL ON wp_db.* TO 'wp_user'@'localhost';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit;
Bye
2.Wordpress Install
|
1 2 3 |
# cd /var/www/html/[FQDN] # wget http://wordpress.org/latest.tar.gz # tar xvf latest.tar.gz |
3.Edit WordPress configuration file
# cd wordpress/
# cp wp-config-sample.php wp-config.php
# vi wp-config.php
------------------------------------------------------------------------------------------------------------------------
// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wp_db' );
/** Database username */
define( 'DB_USER', 'wp_user' );
/** Database password */
define( 'DB_PASSWORD', '?Wwabcd123' );
/** Database hostname */
define( 'DB_HOST', 'localhost' );
/** Database charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );
/** The database collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
---------------------------------------------------------------------------------------------------------------
/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';
/*Also, add the following line at the end.*/
/*If you don't do this, you'll be prompted for FTP connection information when adding plugins.*/
define('FS_METHOD', 'direct');
4.Moving Files
①Move the expanded contents under /var/www/html/[FQDN]
|
1 2 |
# cd /var/www/html/[FQDN] # mv wordpress/* . |
After confirming that the files have been moved, delete the wordpress directory and downloaded latest.tar.gz
|
1 2 3 |
# cd /var/www/html/[FQDN] # rm -Rf wordpress # rm latest.tar.gz |
Make apache the owner of the wordpress directory.
|
1 2 |
# chown -R apache:apache /var/www/html/[FQDN] # systemctl restart httpd |
5.Starting wordpress installation
You can use your browser to go to http://[FQDN]/wp-admin/install.php
If successful, the following WordPress installation information input screen will be output.
「Your PHP installation appears to be missing the MySQL extension which is required by WordPress.」When displayed
Install php library-related software if not already installed.
|
1 2 3 |
# dnf install php-mysqlnd # systemctl restart mysqld # systemctl restart httpd |
again
Access http://[FQDN]/wp-admin/install.php

On the following input screen
・Site Title Any name
・Username Any name
・Password Any password
・Your Email Administrator's email address
Enter the information and click "Install WordPress". Remember to enter your "username" and "password" as they are required to access the WordPress administration screen.

Click on "Login"

User Name : The user name you have just set
Password : User's password you have just set
and click "Login".

After successfully logging in, you will be able to access the following WordPress admin page

