foreword
This article downloads and installs MySQL 8.0 based on the Linux environment, and installs it in the same way as downloading the offline version based on the win 10 system (installation is simple). If there is no remote server, you can install a virtual machine on the computer and use it. For details on creating a virtual machine tutorial, see
: http //t.csdn.cn/IFAJN
Download and install MySQL 8.0 tutorial based on Win 10 system: http://t.csdn.cn/WyDAv
Connect virtual machine tool installation tutorial: http://t.csdn .cn/XVy6u
1. Download MySQL
MySQL official website: https://www.mysql.com/cn/
MySQL 8.0 download address: https://dev.mysql.com/downloads/mysql/
Choose the Linux version installed on your virtual machine and download
2. Install MySQL
1. Unzip the file
Just right-click to decompress, and a lot of .rpm files will be decompressed
2. Upload files
Upload the following selected files
to the /opt folder using the Xftp tool. If the upload status is wrong, turn off the virtual machine firewall and give the folder the highest authority:chmod -R 777 /opt
3. Check dependencies
3.1. Check /tmp temporary directory permissions
During the MySQL installation process, the MySQL user will create a new tmp_db file in the /tmp directory, so give the /tmp folder the highest authority:chmod -R 777 /tmp
3.2. Check dependencies
Check libaio: rpm -qa|grep libaio
Check net-tools: rpm -qa|grep net-tools
If it does not exist, you need to install rpm in the CentOS installation disk. If it is installed with a graphical interface, these are all installed
4. Install
Install the uploaded files in sequence (the order is strictly enforced)
rpm -ivh mysql-community-common-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-client-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-server-8.0.29-1.el8.x86_64.rpm
Dependency detection failed during installation (server):
add --force --nodeps later to ignore dependencies
rpm -ivh mysql-community-server-8.0.29-1.el8.x86_64.rpm --force --nodeps
successfully installed
5. View version
View instructions:mysql --version
3. Use MySQL
1. Initialize the service
In order to ensure that the owner of the database directory and files is the mysql login user, if the mysql service is run as root, execute the command initialization: mysqld --initialize --user=mysql
a password will be generated for the root user, and a new password needs to be set after login, and the generated temporary password will be Log
the view password:cat /var/log/mysqld.log
2. Check whether the service is started
Command: systemctl status mysqld
Start the service if the display is not started: systemctl start mysqld
If the startup is successful, then there is no problem with the installation
3. View service
View process: ps -ef | grep -i mysql
Check whether the service is self-starting: systemctl list-unit-files|grep mysqld.service
the default is enabled
Set self-starting: systemctl enable mysqld.service
Set not to start automatically:systemctl disable mysqld.service
4. Login
Login (enter temporary password):mysql -u root -p
5. Change password
If the password is not changed, the database cannot be operated: alter user 'root'@'localhost' identified by '新密码'
after changing the password, log in again and view the database: show databases;
so far, the offline version of Linux system has successfully installed Mysql 8.0, and the operation is simple. The master-slave database will be built later, and then installed online using the command line