• notice
  • Congratulations on the launch of the Sought Tech site

Linux install mysql8.0

First, the preparatory work
computers 1. a linux system (can be installed with a virtual machine) I installed cenos7.9, can be connected outside the network
installation package of software 2.mysql8.0 Download
choose to download according to the picture just fine the
Insert picture description here
Insert picture description here
after downloading the installation package to the repository next start installing
the files to / usr / loacl / directory

Insert picture description here
unzip files

tar -zxvf  mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz 

Rename the decompressed file directory

mv mysql-8.0.11-linux-glibc2.12-x86_64 mysql1
cd mysql1

Create mysql data folder

mkdir data1

Create mysql user

groupadd mysql1
useradd -g mysql mysql1

Authorize users

chown -R mysql.mysql /usr/local/mysql/1

Initialize the MySQL directory

./bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/ --initialize1

Insert picture description here
After the execution, it will print that there is a temporary password. After mysql is installed, the temporary password will be used. Modify the password.
Modify the mysql configuration file.

vi /etc/my.cnf1

Plus this configuration


Adjust the comments below
Insert picture description here

Add Mysql to the system service

cp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql1


chmod +x /etc/init.d/mysqlchkconfig --add mysql12

Check if the service is in effect

chkconfig --list mysql1

Insert picture description here
Start the mysql service

service mysql start1

Insert picture description here
This shows that it was successful,
log in to mysql

mysql -uroot -p1

Mysql -uroot -p
-bash: mysql: command not found appears,
execute the following command

 ln -s /usr/local/mysql/bin/mysql /usr/bin1

Continue to log in and paste the temporary password above to log in to change the password

mysql -uroot -p1
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '你的密码';1

Refresh permissions


Insert picture description here


Technical otaku

Sought technology together

Related Topic


Leave a Reply