Home  >  Article  >  Database  >  Tutorial on installing mysql in rpm mode under Linux_MySQL

Tutorial on installing mysql in rpm mode under Linux_MySQL

WBOY
WBOYOriginal
2016-11-30 23:59:381222browse

Every installation is always a little different. Let’s try it this way this time and record it too.

1. First you need to download the rpm package:

Mirror address: http://mysql.mirrors.pair.com/Downloads/

You can choose to download according to different versions. What I downloaded is:

MySQL-server-5.6.20-1.el6.i686.rpm

MySQL-client-5.6.20-1.el6.i686.rpm

MySQL-devel-5.6.20-1.el6.i686.rpm (this package is for backup)

Because if you use rpm to install mysql, you will not be able to connect to mysql in command line mode if you only install mysql-server, so you also need to install mysql-client

2. Start installing the server:

Execute command: rpm -ivh MySQL-server-5.6.20-1.el6.i686.rpm

After the installation is completed, there will be a prompt:

Tips 1: After installing mysql-server, a password for the root account will be randomly generated and saved in: /root/.mysql_secret here

Tips 2: After installing mysql-server, you need to change the default password when you connect to mysql for the first time

After confirming this, you need to execute the command: find / -name mysql to find the installation location of mysql-server, as follows:

/etc/logrotate.d/mysql                                                                    /etc/rc.d/init.d/mysql             Startup file
/usr/share/mysql ---- contains my-default.cnf file

/usr/bin/mysql

/usr/lib/mysql
/var/lib/mysql                                                                                                                                                                                 ​
Then execute:

find / -name my.cnf

Find the location of the configuration file of mysql-server, as follows:

/usr/my.cnf

Then start mysql-server and execute:

/etc/init.d/mysql start

Execute after successful startup:

ps -el | grep mysql

The system will list the related process information of mysqld, indicating that mysql-server is successfully installed!

3. Install mysql-client:

Since there is no way to connect to the database from the command line after installing mysql-server, you need to continue to install mysql-client and execute the command:

rpm -ivh MySQL-client-5.6.20-1.el6.i686.rpm

After a while, the system will prompt that the installation is successful. At this time, execute:

mysql -u root -p to connect to mysql. When connecting, you need to enter a password. The password is the random password generated before. Enter it and it will be successful!

After entering the mysql console, execute: show databases;

I found that the system prompted that I need to change the password first, so: exit the system first, and then execute: mysqladmin -u root -p password 'new-passwd'

To change the password, then connect to mysql again, enter the password you just set, and then continue to execute the show databases; command and find it successful!

4. Then there is a question, do I still need to install the mysql-devel package?

Try it.

Execution:

rpm -ivh MySQL-devel-5.6.20-1.el6.i686.rpm

It will prompt that the installation is successful, then connect to mysql and execute show databases; it still works. . . !

Google it:

MySQL-devel seems not too necessary~~

The above is the entire content of this article. I hope it will be helpful to everyone’s study and I hope you will support me a lot.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn