Ubuntu 16.04, Ubuntu 16.04, Ubuntu 16.04, Ubuntu 16.04, Ubuntu 16.04, Ubuntu 16.04, Ubuntu 16.04, Ubuntu 16.04
MySQL Community Server 8.0.11
Two, the installation process
1. Download the installation package
The Linux 64-bit universal secondary version is selected, so that the system does not need to compile and install, the dependency library can be directly used by the system.
2. Install the dependent libraries
If you need to install libaio, you need to install numactl as well
apt install numactl
apt install libaio-dev
Copy the code
3. Decompress the software package to the system
After decompressing the package, move it to the /usr/local directory on your system and name it mysql
Tar -zxvf mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz mv mysql-8.0.11-linux-glibc2.12-x86_64 /usr/local/mysql
Copy the code
4. Add users and set permissions
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
cd /usr/local
cd mysql
mkdir mysql-files
chown mysql:mysql mysql-files
chmod 750 mysql-files
Copy the code
5. Initialize the database
bin/mysqld --initialize --user=mysql
Copy the code
You can see that the system randomly assigns a password to the root user, as shown in the figure below. This password should be remembered and can be changed later if you want to customize it
6. Install the SSL service
Install OpenSSL before running the installation command; otherwise, an error message will be displayed
apt install openssl
bin/mysql_ssl_rsa_setup
Copy the code
7. Copy the service file
cp support-files/mysql.server /etc/init.d/mysql.server
Copy the code
MySQL 8.0.11
1. Enable the service
& means background operation. After executing the command, the terminal will be stuck in a position. Press Enter again, as shown in the figure
bin/mysqld_safe --user=mysql &
Copy the code
2. Log in as user root
Use the random generated password just now, can be included in the database
bin/mysql -uroot -p
Copy the code
3. Change the password of user root
The random login won’t work the first time, so we need to change the password as follows (1). Solution 1: Restrict local login
ALTER USER 'root'@'localhost' IDENTIFIED BY 'New password';
flush privileges;
Copy the code
(2). Scheme 2: You can log in to the third-party client with any IP address
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; Change the root password and encryption mode
use mysql; Switch to the mysql library
update user set host=The '%' where user = 'root'; # change the login IP address to any IP address
flush privileges; # refresh permission
ALTER USER 'root'@The '%' IDENTIFIED WITH mysql_native_password BY 'password'; Change the root password again to make it accessible from any IP address
flush privileges; # refresh permission
Copy the code
Once you’ve made the changes, log out and re-log in with the new password, look at the database again, and see that it’s ready to use
MySQL 8.0.11 installation is complete. Thank you for reading. If you have any questions, please leave a comment