Table of contents
Check whether mysql is installed
It is not easy to organize, please read carefully, I hope it will be helpful to you
Introduction to rpm command
Installation format command rpm -ivh package full name
Options -i means installation -v means display details
-h (hash) Use "#" to display progress
-U upgrade -e uninstall -q query -a conflict
--force Force installation, even if files belonging to other packages are overwritten, they must be installed
--nodes do not detect dependencies
Practice plan
rpm -ivh installation rpm -qa query
rpm -e --nodps uninstall without checking dependencies (uninstall the old version and install the new version)
Check whether mysql is installed
1. Check whether mysql is installed on Linux
2. Check whether mariadb is installed (if found, use rpm -e --nodeps)
The configuration files contained also need to be uninstalled.
rm -rf /etc/my.cnf
rm -rf /var/lib/mysql
Installation steps of mysql
Installation package download address:
Index of /MySQL/Downloads/MySQL-5.7/http://ftp.ntu.edu.tw/MySQL/Downloads/MySQL-5.7/
mysql-5.7.31-1.el7.x86_64.rpm-bundle.tar
On Linux, enter /opt to create a folder mysql and put the downloaded installation package into the folder.
Unzip the folder
tar -xvf mysql-5.7.31-1.el7.x86_64.rpm-bundle.tar
Install the corresponding dependency packages
install perl yum install perl
Install tools yum install net-tools
Install client and server
The order cannot be changed
rpm -ivh mysql-community-common-5.7.31-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.31-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.31-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.31-1.el7.x86_64.rpm
Check whether systemctl status mysqld is started
Start systemctl start mysqld
running means starting
Change the login password (the root user exists but the password does not exist)
Generate a temporary password by grep password /var/log/mysqld.log
b,XacKV#H0bsThis is the temporary password
The temporary password can only be used once. You must change the password when you log in to MySQL for the first time.
Log in via mysql -u root -p password
Change password set password = password("Ghd_123456");
exit exit
Then log in again with the new password
client: Client program: Which customer needs to use this service program, install this client software
server server program, installed on the server
When installing mysql in win, the connection cannot be made.
Add remote login permissions on the server side
Restart linux, log in to mysql to configure permissions, and connect
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root@% IDENTIFIED BY 'QWer 1234' WITH GRANT OPTION;
mysql>FLUSH PRIVILEGES;
Modify the database default encoding and execution engine
Log in first to view the database character encoding format show variables like '%char%';
Change the two Latin1 to gbk
Exit the database system and close the database systemctl stop mysqld
Enter the etc folder and modify vi my.cnf
The client file is placed at the bottom