The entire process of uninstalling and installing MySQL in Linux

Source: Internet
Author: User

Uninstall MySQL in Linux

1. Check whether MySQL is installed before.

Command: rpm-qa | grep-I MySQL

We can see two MySQL packages:

MySQL-4.1.12-3.RHEL4.1

MySQLclient10-3.23.58-4.RHEL4.1

2. Delete MySQL

DELETE command: rpm-e -- nodeps package name

(Rpm-ev MySQL-4.1.12-3.RHEL4.1)

3. Delete the development header files and libraries of old MySQL versions.

Command: rm-fr/usr/lib/MySQL

Rm-fr/usr/include/MySQL

Note: After uninstallation, data in/var/lib/MySQL and/etc/my. cnf will not be deleted. If you are sure it is useless, manually delete it.

Rm-f/etc/my. cnf

Rm-fr/var/lib/MySQL


Install MySQL

Preparations before installation: Two rpm packages

MySQL-client-5.1.20-0.glibc23.i386.rpm

MySQL-server-5.1.20-0.glibc23.i386.rpm

1. Install the server:

Command: rpm-ivh MySQL-server-5.1.20-0.glibc23.i386.rpm

After the installation is successful ....

Warning: MySQL-server-5.1.20-0.glibc23.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5

Preparing... ######################################## ### [100%]

1: mySQL-server ##################################### ###### [100%]

080220 13:58:27 [Note] Plugin 'innodb' disabled by command line option

080220 13:58:28 [Note] Plugin 'innodb' disabled by command line option

Please remember to set a password for the MySQL root USER!

To do so, start the server, then issue the following commands:

/Usr/bin/MySQLadmin-u root password 'new-password'

/Usr/bin/MySQLadmin-u root-h localhost. localdomain password 'new-password'

See the manual for more instructions.

Please report any problems with the/usr/bin/MySQLbug script!

The latest information about MySQL is available on the web

Http://www.MySQL.com

Support MySQL by buying support/licenses at http://shop.MySQL.com

Starting MySQL. [OK]

2. Install the client

Command: rpm-ivh MySQL-client-5.1.20-0.glibc23.i386.rpm

Successful Performance:

[Root @ localhost ~] # Rpm-ivh MySQL-client-5.1.20-0.glibc23.i386.rpm

Warning: MySQL-client-5.1.20-0.glibc23.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5

Preparing... ######################################## ### [100%]

1: mySQL-client ##################################### ###### [100%]

3. log on to MySQL

The command used to log on to MySQL is MySQL. the syntax of MySQL is as follows:

MySQL [-u username] [-h host] [-p [password] [dbname]

Username and password are the username and password of MySQL respectively. The initial management account of MySQL is root, and there is no password. Note: This root user is not a Linux system user. The default MySQL user is root. Because there is no password at first, you only need to type MySQL for the first time.

[Root @ localhost ~] # MySQL

Welcome to the MySQL monitor. Commands end with; or \ g.

Your MySQL connection id is 2

Server version: 5.1.20-beta MySQL Community Server (GPL)

Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.

MySQL>

The prompt "MySQL>" appears. Congratulations! The installation is successful!

The logon format after the password is added is as follows:

MySQL-u root-p

Enter password: (Enter the password)

-U is followed by the user name.-p requires the password. Press enter and enter the password at the Enter password.

Note: This MySQL file is located in the/usr/bin directory. It is not a file with the Startup file/etc/init. d/MySQL described later.

Supplement:

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:

  • 1
  • 2
  • 3
  • Next Page

Related Article

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.