1. Preparation before installation
Before installing MySQL, you need to prepare the following files and programs:
1, MySQL source code package
2, cmake program
3, tar program
4, gcc Procedure
2. Decompress the source code package
Use tar to decompress the MySQL source code package and enter the MySQL source code directory.
tar -xzvf mysql-5.6.24.tar.gz
cd mysql-5.6.24
3. Compile and install
Execute the following instructions to compile and install MySQL.
cmake .
make
make install
4. Initialize MySQL database
Use the following instructions to initialize the MySQL database.
bin/mysqld --initialize --user=mysql
Write down the generated temporary password, which will be used to log in to MySQL later.
5. Start the MySQL service
Use the following command to start the MySQL service.
bin/mysqld_safe &
Or
service mysql start
6. Log in to MySQL
Use the following command to log in to MySQL.
bin/mysql -uroot -p
Enter the temporary password just generated, you need to reset the password later.
7. Change Password
Enter the following command to change the password.
set password = password('new password');
After the modification is successful, use the following command to exit MySQL.
quit
8. Summary
Installing MySQL requires the following steps: decompress the source code package, compile and install, initialize the MySQL database, start the MySQL service, log in to MySQL and change the password. Pay attention to security when using MySQL to prevent illegal intrusion.
The above is the detailed content of How to install mysql in linux tar. For more information, please follow other related articles on the PHP Chinese website!