Foreword
Record the offline installation of the latest Mysql8.0.32 on KylinV10, and the pitfalls encountered
1. Prepare
1. Uninstall mariadb
If there is an old version of MariaDB in the system, if you install MySQL directly, it will conflict with MariaDB files. To be on the safe side, first uninstall the built-in MariaDB, and then install MySQL.
#Find mariadb rpm -qa|grep -i mariadb #Uninstall mariadb sudo yum remove mariadb mariadb-server
#View again rpm -qa|grep -i mariadb # continue to delete rpm -e --nodeps find mariadb related For example: sudo rpm -e --nodeps mariadb-connector-c-3.0.6-7.ky10.x86_64
Don’t do anything, just delete it thoroughly
whereis mariadb #Use the command rm -rf xxx to delete the above files in turn
Deleted this time
2. Delete mysql related files
Delete the old mysql related files automatically by the system to avoid conflicts with new ones
#Find mysql software related rpm -qa|grep -i mysql #Delete related software found by sudo rpm -ev --nodeps sudo rpm -ev --nodeps perl-DBD-MySQL-4.046-6.ky10.x86_64 sudo rpm -ev --nodeps qt5-qtbase-mysql-5.11.1-11.p01.ky10.x86_64 sudo rpm -ev --nodeps python2-mysqlclient-1.3.12-8.ky10.x86_64
#Find mysql related files where is mysql #Use the command rm -rf xxx to delete the above files in turn
This time I deleted everything that should be deleted.
3. Download mysql8.0.3.2
mysql official website
After downloading, upload to the server
Two, install mysql8.0.3.2
Decompress the tar package of mysql
tar -xvf mysql-8.0.32-1.el7.x86_64.rpm-bundle.tar
Execute strictly in order
rpm -ivh mysql-community-common-8.0.32-1.el7.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-client-plugins-8.0.32-1.el7.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-libs-8.0.32-1.el7.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-client-8.0.32-1.el7.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-icu-data-files-8.0.32-1.el7.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-server-8.0.32-1.el7.x86_64.rpm --nodeps --force
Check the mysql version and check whether it is successfully installed
mysql --version
Error:
mysqld: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
solve:
Download compat-openssl10-1.0.2o-3.el8.x86_64.rpm, after uploading, install
rpm -i compat-openssl10-1.0.2o-3.el8.x86_64.rpm
Check the mysql version again to check whether the installation is successful
Three, configure mysql
mysqld --initialize --user=mysql
- In order to ensure that the owner of the database directory and files is the mysql login user, if you run the mysql service as root, you need to execute the following command initialization;
- Note: The –initialize option is initialized in “safe” mode by default, and a password will be generated for the root user and marked as expired. After logging in, you need to set a new password, and the generated temporary password will be recorded in the log share.
For the first time, check the initialization password
cat /var/log/mysqld.log
At this point, our mysql service has not started yet, so we log in for the first time
mysql -uroot -p
Enter password: enter the initialization password
change Password
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';
For example: ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘123456’;
Open external access refresh permissions
#Switch to mysql use mysql; # All machines have access to the root user update user set host="%" where user="root"; # reload permissions FLUSH PRIVILEGES;
check
view all databases
show databases;
View the location of mysql data
SHOW GLOBAL VARIABLES LIKE '?tadir%';
modify port
vim /etc/my.cnf
view port
show global variables like 'port';
If modifying the port is invalid, try to close SELinux, or modify my.cnf. The custom my.cnf may need to specify a configuration file to execute, which is related to the order in which mysql starts to find configuration files by default.
Skip permission verification
(When you forget the password, you can use it, use mysql, press Enter to enter, and modify the password)
#View mysql status systemctl status mysqld #start up systemctl start mysqld #stop systemctl stop mysqld.service #restart systemctl restart mysqld.service
run
stop