MySQL-5.7 installation
1. Windows
Installation preparation: After downloading the compressed package ( official website ) and decompressing it, enter the bin directory
1. Execute mysqld -install [serviceName] in the current directory, serviceName is the service name, the default is MySQL
2. Execute mysqld --initialize, it will be executed for a period of time, wait patiently, after execution, there will be an additional data folder in the mysql decompression and directory
3. There is a .errr file in the data folder, which contains a randomly generated root user password:
4. Login: mysql -uroot -p, then paste the password
5. Modify the password: ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpasswd';
6. Delete the mysql service: mysqld --remove serviceName , the serviceName is filled in when it was just installed.
Second, Linux
1. Prepare
2. Create a new user mysql user and user group
First check if the mysql user exists
If it does not exist, create the mysql user as a system user
Check if mysql or mariadb is installed on the system
If there is, execute the following command to delete
3. Installation
Enter the installation directory and execute the following commands in sequence
Note that the above rpm packages must be installed in the order above, because each package is dependent on each other
After installation, enter the /usr/bin directory, check whether /var/lib/mysql/ exists, and delete it if it exists
Then initialize MySQL, execute the following command
So far, mysql-5.7 is installed
Execute the following command to start MySQL
common problem
1. I get the following error when initializing MySQL
Solution: Modify the selinux configuration file and change the SELINUX value to permissive
2. Error starting mysql
Solution:
Execute the following command
If there is an error executing the above command, execute
Then execute
start
3. If the error that occurs is not the error mentioned above, then you can use
Check the MySQL log, type G to turn to the last page, go forward to find the ERROR log of the output level, and then copy the corresponding error description to google/stackoverflow to search for a solution.