Install, configure, and uninstall mysql_MySQL using the rpm Package

Source: Internet
Author: User
Through rpm Package installation, configuration and uninstall mysql detailed process. take the MySQL-server-4.0.14-0.i386.rpm as an example, put in the data directory after the cddatarpm-ivhMySQL-server-4.0.14-0.i386.rpm installation is complete in the usrsharemysql directory will have a mysql start mysql uninstall mysql installation

Detailed process of installing, configuring, and detaching mysql through rpm packages.

Take MySQL-server-4.0.14-0.i386.rpm as an example, put it under the/data Directory

Cd/data

Rpm-ivh MySQL-server-4.0.14-0.i386.rpm

After installation is complete, there will be a mysql startup script in the/usr/share/mysql directory mysql. server and sample configuration files (such as my-huge.cnf, my-large.cnf, my-medium.cnf)

Copy an example 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. Therefore, you can run the following command to start or 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 mysql service has been installed and configured.

Install the 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 the error log file, binary log file and process file in the/var/lib/mysql Directory, such as localhost. err, localhost. pid, localhost-bin.001, etc.

To change these conditions, modify the/etc/my. cnf file.

For example, to write a 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/usr/bin/mysql_install_db which can be used to initialize the mysql database, that is, to create the/var/log/mysql directory and to create the mysql database (mysql authorization table and other information) and test database (empty database), if you accidentally delete the/var/log/mysql directory, you can use this program to initialize.

Uninstall mysql

Rpm-qa | grep-I mysql

Rpm-ev MySQL-server-4.0.14-0 MySQL-client-4.0.14-0

Data in/var/lib/mysql and/etc/my. cnf will not be deleted after uninstallation. if it is determined that it is useless, it will be deleted manually.

Rm-f/etc/my. cnf

Rm-rf/var/lib/mysql

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.