This article mainly tells you about the three installation methods of MySQL, And the RPM Binary Package and source code. The system platform we installed this time is redhat 5, the following is a detailed description of the main content of the article. I hope you will have a better understanding of it after browsing.
MySQL installation method 1. Use the RPM package for Installation
First, you can download the rpm package of the corresponding version from the installation disc or to the MySQL website as follows:
- MySQL-server-community-5.1.38-0.rhel5.i386.rpm
- MySQL-client-community-5.1.38-0.rhel5.i386.rpm
Then we can use the rpm command for installation:
Rpm-ivh MySQL-server-community-5.1.38-0.rhel5.i386.rpm
Rpm-ivh MySQL-client-community-5.1.38-0.rhel5.i386.rpm
Three installation methods for MySQL II. Binary Package Installation
The procedure is as follows:
1. Use root to log on to the system and add MySQL users and groups.
- groupadd MySQL
- useradd -g MySQL MySQL
2. decompress the Binary Package. If the Binary Package is stored in/home/MySQL, decompress the package and add a symbolic link.
- tar xvfz MySQL-5.1.38-linux-i686-glibc23.tar.gz
- ln -s MySQL-5.1.38-linux-i686-glibc23 MySQL
3. Create a system database table in the database directory. -- user indicates that the owner of these databases and tables is the user
- cd MySQL
- ./scripts/MySQL_install_db --user=MySQL
4. Set directory permissions and change the owner of the data directory to MySQL. The owner of files in other directories is root.
- chown -R root:MySQL .
- chown -R MySQL:MySQL data
5. Start MySQL
./Bin/MySQLd_safe -- user = MySQL &
Three installation methods for MySQL 3. Install MySQL with source code
1. Use root to log on to the system and add MySQL users and groups.
- groupadd MySQL
- useradd -g MySQL MySQL
2. decompress the source code package and enter the decompressed directory.
Tar xvfz MySQL-5.1.38.tar.gz
Cd MySQL-5.1.38
3. Use the configure tool to compile the source code. here we can use a lot of parameters. For details, see configure -- help. Here we will install MySQL under/usr/local/MySQL.
- ./configuer --prefix=/usr/local/MySQL
- make
- make install
4. select a sample configuration file and copy it to/etc/and rename it my. cnf.
Cp support-files/my-medium.cnf/etc/my. cnf
5. Create a system database table in the database directory. -- user indicates that the owner of these databases and tables is the user
- cd /usr/local/MySQL
- ./bin/MySQL_install_db --user=MySQL
6. Set directory permissions and change the owner of the var directory to MySQL. The owner of other directories and files is root.
- chown -R root .
- chown -R MySQL var
- chgrp -R MySQL .
7. Start MySQL
./Bin/MySQLd_safe -- user = MySQL &