Installing and Uninstalling MySQL 8.0 with Common Error Resolution
Installing MySQL 8.0
Operations assume execution under the root account.
- Create the target directory:
cd /usr/local
mkdir db_mysql
- Retrivee the repository package:
wget https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm
- Register the MySQL YUM repository:
yum -y localinstall mysql80-community-release-el7-3.noarch.rpm
- Install the repository metadata:
rpm -ivh mysql80-community-release-el7-3.noarch.rpm
- Install the server component:
yum install mysql-community-server
If GPG verification fails with a message such as Failing package is: mysql-community-client-8.0.36-1.el7.x86_64, retry with signature check disabled:
yum install mysql-community-server --nogpgcheck
- Start the database service and configure boot behavior:
systemctl start mysqld
service mysqld status
systemctl enable mysqld
systemctl daemon-reload
- Access the instance:
The initial root password is written to the log:
grep "A temporary password" /var/log/mysqld.log
mysql -u root -p
If authentication fails (Access denied for user 'root'@'localhost'), disable credential checks temporari:
service mysqld stop
Edit /etc/my.cnf and append:
skip-grant-tables
Restart the service:
service mysqld start
Then connect and reset credentials:
FLUSH PRIVILEGES;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewStrongPwd123!';
Passwords must meet default complexity rules unless adjusted.
- Adjust password policy parameters:
Inspect current settings:
SHOW VARIABLES LIKE 'validate_password%';
To simplify requirements:
SET GLOBAL validate_password.policy = 0;
SET GLOBAL validate_password.length = 4;
Removing MySQL 8.0
Applicable to other versions with minor adjustments.
- Stop the running service:
systemctl stop mysqld
- Enumeraet installed packages:
rpm -qa | grep mysql
- Remove packages via YUM:
yum remove mysql mysql-server mysql-libs mysql-common
- Verify no packages remain:
rpm -qa | grep mysql
- Purge leftover files and directories:
# Remove any residual RPM entries shown in step 4
rpm -e <package_name>
rm -rf /usr/local/db_mysql
rm -rf /var/lib/mysql
rm -rf /etc/my.cnf