How to Install MySQL 8.0 on RHEL/CentOS 7

Basic Server Setup

Setup MySQL 8.0

Setup Firewall (Optional)

Reboot after Setup

Optional Settings for MySQL 8.0

Disable MySQL Strict Mode

Reference: https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html

Fix MySQL Password Expired

To establish a global policy such that passwords never expire.

Update /etc/my.cnf

Reference: https://dev.mysql.com/doc/refman/8.0/en/password-management.html#password-expiration-policy

How to fix MySQL connection error: Authentication plugin ‘caching_sha2_password’ cannot be loaded: dlopen(/usr/local/mysql/lib/plugin/caching_sha2_password.so, 2): image not found

The problem is some MySQL clients not yet support new password encryption method.

 

Just change the user password encryption back to legacy version, then problem will be fixed.

The following SQL update specific user to legacy encryption:

 

Also, you can change the default authentication plugin to legacy version.

Update /etc/my.cnf and add the following line after [mysqld]:

 

 

MySQL ERROR 1366 (HY000): Incorrect integer value: ” for column ‘id’ at row 1 Problem & Fix

 

Problem:

MySQL throw the following error message on insert or update statement executed

 

Why?

Try to update string value into integer column, and strict sql mode is enabled.

Mainly occurred on MySQL 5.x or above.

 

How to Fix:

1. Disable strict sql mode

Update /etc/my.cnf , and remove STRICT_TRANS_TABLES from sql-mode

 

References:

https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_strict_trans_tables

Most Simple and Fastest Way to Backup and Restore a MySQL Database (mysqldump & mysql client)

How to mysqldump and mysql to backup and restore a database:

Backup to .sql file

 

Restore from .sql file

 

Suggested to run the command in database server to get the fastest speed.

 

References:

https://dev.mysql.com/doc/refman/5.7/en/mysqldump.html

How to Install MySQL 5.7 on RHEL/CentOS 7

Basic Server Setup

 

 

 

Setup MySQL 5.7

 

 

Setup Firewall (Optional)

 

Reboot after Setup

 

Optional Settings for MySQL 5.7

Disable MySQL Strict Mode

Reference: https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html

 

Fix MySQL Password Expired

To establish a global policy such that passwords never expire.

Update /etc/my.cnf

Reference: https://dev.mysql.com/doc/refman/5.7/en/password-expiration-policy.html