I have always considered MySQL database applications in Linux to be tricky. This time, by setting up a Linux learning environment, I will study and learn how to install and uninstall MySQL Databases in Linux.
1. Let's take a look at uninstallation, as shown in:
The preceding commands are clear at a glance. After the uninstallation is complete, delete the configuration file/etc/My. CNF and database file/var/lib/MySQL.
SometimesWhen the centos built-in MySQL instance is uninstalled, it cannot be uninstalled.
[Root @ ~] # Rpm-ev mysql-libs-5.1.66-2.el6_3.x86_64
Error: Failed dependencies:
Libmysqlclient. so.16 () (64bit) is needed by (installed) postfix-2: 2.6.6-2.2.el6 _ 1. x86_64
Libmysqlclient. so.16 (libmysqlclient_16) (64bit) is needed by (installed) postfix-2: 2.6.6-2.2.el6 _ 1. x86_64
Mysql-libs is needed by (installed) postfix-2: 2.6.6-2.2.el6 _ 1. x86_64
Solution:Rpm-e -- nodeps mysql-libs-5.1.66-2.el6_3.x86_64
2. Next, Let's explain how to install it. First, download the following two RPM packages. Here we will explain how to install the RPM package.ProgramPackage installation method will be described later.
First install the server program, as shown in:
After the server is installed, a MySQL STARTUP script is generated in the/usr/share/MySQL directory. server and some sample configuration files, which have a configuration file my-medium.cnf, because MySQL becomes a system service by default after installation is complete, so here you need to put the configuration file under the relevant directory of the system service, because the following operations are required:
CP/usr/share/MySQL/my-medium.cnf/etc/My. CNF, renamed my. CNF as the MySQL configuration file.
The following describes how to start and stop the MySQL service, as shown in:
The installation and configuration of the MySQL server have been completed.
3. Install the mysql client program
The installation command is like a server: rpm-IVH MySQL-client-5.5.8-1.linux2.6.i386.rpm
After MySQL is installed, the directory structure is as follows:
The server program is/usr/sbin/mysqld.
The data directory is/var/lib/MySQL. By default, log files are stored in/var/lib/MySQL. If you want to change the storage location, you can change/etc/My. CNF configuration file implementation.
4. log on to the MySQL database. After the installation is complete by default, the MySQL user name is root and the password is blank. Therefore, if the installation is successful, Log On As shown in:
As shown in, you have successfully logged on to the MySQL database.
5. After logging on to the database, import the database script. The command is as follows:
Source/root/test. SQL.
In Linux, do you need to configure the connection between JSP and MySQL? Because you have compiled a connection database program in the program, you do not need to set anything here, you only need to adjust the connection address in the database configuration file.
The installation and uninstallation processes of MySQL are described in detail.