Home >Backend Development >PHP Tutorial >Detailed process of installing, configuring and uninstalling mysql using rpm package._PHP tutorial
Detailed process of using rpm package to install, configure and uninstall mysql tutorial.
Detailed process of installing, configuring and uninstalling mysql through rpm package.
Take MySQL-server-4.0.14-0.i386.rpm as an example and place it in the /data directory
cd /data
rpm -ivh MySQL-server-4.0.14-0.i386.rpm
After the installation is completed, there will be a mysql startup script mysql.server and sample configuration files (such as my-huge.cnf, my-large.cnf, my-medium.cnf) in the /usr/share/mysql directory
Copy a sample configuration file as the mysql configuration file:
cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
After the rpm package is installed, mysql is automatically installed as a system service, so you can use the following commands to start and stop mysql
Start mysql
/etc/init.d/mysql start or service mysql start
Stop mysql
/etc/init.d/mysql stop or service mysql stop
At this point, the installation and configuration of the mysql service is complete.
Install mysql client
rpm -ivh MySQL-client-4.0.14-0.i386.rpm
After mysql is installed, the directory structure is as follows:
The tool program is in the /usr/bin directory——ls /usr/bin/mysql*
Server program/usr/sbin/mysqld
Data directory/var/lib/mysql
By default, mysql writes error log files, binary log files and process files in the /var/lib/mysql directory, such as localhost.err, localhost.pid, localhost-bin.001, etc.
To change these situations, you can modify the /etc/my.cnf file
If you write the log file in the /var/log directory, you can add the following two lines to the my.cnf file:
[mysqld_safe]
err-log = /var/log/mysqld.log
There is a utility program /usr/bin/mysql_install_db, which can be used to initialize the mysql database tutorial, that is, create the /var/log/mysql directory, and create the mysql database (mysql authorization table and other information) and the test database (empty database). If you accidentally delete the /var/log/mysql directory, you can initialize it through this program.
Uninstall mysql
rpm -qa|grep -i mysql
rpm -ev MySQL-server-4.0.14-0 MySQL-client-4.0.14-0
After uninstallation, the data in /var/lib/mysql and /etc/my.cnf will not be deleted. If it is determined to be useless, delete it manually
rm -f /etc/my.cnf
rm -rf /var/lib/mysql