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
after downloading the installation package to the repository next start installing
the files to / usr / loacl / directory
unzip files
tar -zxvf mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz
1
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
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
datadir=/usr/local/mysql/data/socket=/tmp/mysql.sockbasedir=/usr/local/mysql/character-set-server=UTF8MB41234
Adjust the comments below
#[mysqld_safe]
#log-error=/var/log/mariadb/mariadb.log
#pid-file=/var/run/mariadb/mariadb.pid
Add Mysql to the system service
cp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql1
Authorization
chmod +x /etc/init.d/mysqlchkconfig --add mysql12
Check if the service is in effect
chkconfig --list mysql1
Start the mysql service
service mysql start1
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
FLUSH PRIVILEGES;1
0 Comments