How to Install MySQL 8.0 on CentOS 7
How to Install MySQL 8.0 on CentOS 7
In this article, we are going to see how to install MySQL 8.0 on CentOS
MySQL server is the most popular open source relational database management system (RDBMS). MySQL has become the leading database choice web-based applications, Used by high profile web properties.
How to Install MySQL and Enable MySQL Community Repository
### On CentOS/RHEL 7 system ### # rpm -Uvh https://repo.mysql.com/mysql57-community-release-el7-11.noarch.rpm ### On CentOS/RHEL 6 system ### # rpm -Uvh https://repo.mysql.com/mysql57-community-release-el6-11.noarch.rpm
Install MySQL 8.0 Community Server
After enabling and installing MySQL community repository now install MySQL server. Follow the below command to install MySQL 8.0 community server on your system.
# yum --enablerepo=mysql80-community install mysql-community-server
Installing process may take some time to install
Start MySQL Service
After installing MySQL server now lets start MySQL service using below command.
# systemctl start mysqld.service
Find MySQL Root Password
If you install MySQL 8.0 it will create a temporary password for MySQL root user. You can find this password using its log file as shown below.
# cat /var/log/mysqld.log | grep "A temporary password"
[Note] [MY-010454] [Server] A temporary password is generated for root@localhost: nue8K6uW4d=D
MySQL Secure Installation
# mysql_secure_installation
You will get the output as:
Securing the MySQL server deployment. Enter password for user root: Enter the current password taken from /var/log/mysqld.log The existing password for the user account root has expired. Please set a new password. New password: Enter new Password Re-enter new password: Re Enter the new password The 'validate_password' plugin is installed on the server. The subsequent steps will run with the existing configuration of the plugin. Using existing password for root. Estimated strength of the password: 100 Change the password for root ? ((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) : 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. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y Success. All done!
Restart and Enable MySQL Service at Boot Time
After following all MySQL installation now restart MySQL service using below command.
### Using SysVinit # service mysqld restart ### Using Systemd # systemctl restart mysqld.service
Now enable service to auto start at system boot time using below command.
### Using SysVinit # chkconfig mysqld on ### Using Systemd # systemctl enable mysqld.service
Connect to MySQL server
Now connect to your MySQL database server using below command. It will prompt for password for authentication.
# mysql -h localhost -u root -p
Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 8.0.12 MySQL Community Server - GPL Copyright (c) 2000, 2018, 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>
Once successfully login you will get MySQL command prompt.
Hope, this article helps you. Please share your comments to improve us.
For configuring FTP Passive port range in cPanel server: Click here