Install MySQL under Linux

Source: Internet
Author: User
Tags mysql client

There are two main ways to install MySQL: one is self-compiling through the source of the installation, this is suitable for advanced user custom MySQL features, not to do this, and the other is to install through the compiled binary files. Binary file installation methods are divided into two types: one is not for the specific platform of the common installation method, the use of the binary file is the suffix. tar.gz of the compressed file, the second is to use the RPM or other packages for installation, the installation process will automatically complete the configuration of the system, so it is more convenient.

To download the installation package:

Official:

http://dev.mysql.com/downloads/mysql/#downloads

or image file Download:

Http://dev.mysql.com/downloads/mirrors.html

Here are the steps to install the RPM file:

1. Check if it is installed, grep's-i option indicates ignore case when matching

Rpm-qa|grep-i MySQL

It can be seen that the library files have been installed, should be uninstalled first, or there will be overwrite errors. Note The--nodeps option is used when uninstalling, ignoring dependencies:

sudo rpm-e mysql-libs-5.1.66-2.el6_3.i686--nodeps

2. Install the MySQL server-side software, and note the switch to the root user:

RPM-IVH mysql-server-5.1.73-1.glibc23.i386.rpm

When the installation is complete, the installation process adds a MySQL group to Linux and MySQL for users who belong to the MySQL group. Can be viewed by the ID command:

ID MySQL

MySQL server after installation, although the relevant files are configured, but does not automatically start the MYSQLD service, you need to start it yourself:

Service MySQL Start

Check to see if MySQL is booting properly by checking that the port is turned on:

Netstat-anp|grep 3306

3. Install the MySQL client software:

RPM-IVH mysql-client-5.1.73-1.glibc23.i386.rpm

Enter MySQL directly:

4. Configure the user password:

Method 1: Use the Set password command

Mysql-u Root

mysql> SET PASSWORD for ' root ' @ ' localhost ' = PASSWORD (' Newpass ');

Method 2: Use Mysqladmin

mysqladmin-u root Password "Newpass"

If Root has already set a password, use the following method

mysqladmin-u root password Oldpass "Newpass"

Method 3: Edit the user table directly with update

Mysql-u Root

mysql> use MySQL;

mysql> UPDATE user SET Password = Password (' newpass ') WHERE user = ' root ';

mysql> FLUSH privileges;

This can be done when the root password is lost

Mysqld_safe--skip-grant-tables&

Mysql-u Root MySQL

mysql> UPDATE user SET Password=password ("New password") WHERE user= ' root ';

mysql> FLUSH privileges;

For example, use the first method:

This allows you to log in by using a password.

Install MySQL under Linux

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.