Linux yum install MySQL

Source: Internet
Author: User
Tags mysql client

1, installation check has been installed:

Yum List installed mysql*

Rpm-qa | grep mysql*

To see if there are any installation packages:

Yum List mysql*

To install the MySQL client:

Yum install MySQL

To install the MySQL server side:

Yum Install Mysql-server Yum

Install Mysql-devel

2. Start && Stop database character set

MySQL config file/etc/my.cnf add Default-character-set=utf8

Start MySQL services: Service mysqld start or/etc/init.d/mysqld start

Boot start:

Add boot up: chkconfig--add mysqld;

Boot: Chkconfig mysqld on;

See if boot boot settings are successful chkconfig--list | grep mysql* mysqld 0: Off 1: Off 2: Enable 3: Enable 4: Enable 5: Enable 6: Off STOP:

Service Mysqld Stop

3. Login to create the root administrator:

Mysqladmin-u Root Password 123456

Login: mysql-u root-p Enter the password. Forgot Password:

Service mysqld stop;

Mysqld_safe--user=root--skip-grant-tables;

This step does not appear when the new command line, you need to reopen a window to execute the following command

Mysql-u Root;

Use MySQL;

Update user set Password=password ("123456") where user= "root";

Flush privileges;

4. Remote access to the port number of the open firewall MySQL

Add Permission: The user table in the MySQL library has a new record of "%" and the user is "root".

5. Several important directories of Linux MySQL

Database Directory/var/lib/mysql/

Configuration file/usr/share/mysql (mysql.server command and configuration file)

Related Commands/usr/bin (mysqladmin mysqldump, etc.)

Startup script/etc/rc.d/init.d/(startup script file for MySQL directory)

6. Delete MySQL Database

If you are using a yum installed MySQL and need to be removed, use the following command:

Yum-y Remove mysql*

Then delete all files under the/var/lib/mysql folder clean

Finally, re-execute the above installation steps.

7. Authorized User from remote login

Note: The following 2 steps need to be performed, step 1. Just modified the user's password, but did not authorize the user, step 2 is the role of authorization, so that the user can have the specified permissions (connect the database, query the database ...) );

1. Change the table method. It may be that your account is not allowed to log on remotely, only on localhost. This time, as long as the computer on the localhost, log in to MySQL, change the "MySQL" Database in the "User" table "host", from "localhost" to "%"

Mysql-u Root-pvmware;

Mysql>use MySQL;

Mysql>update User Set host = '% ' where user = ' root ';

Mysql>select host, user from user;

2. Authorization law. For example, if you want to myuser use MyPassword to connect to a MySQL server from any host.

GRANT all privileges on * * to ' myuser ' @ ' percent ' identified by ' MyPassword ' with GRANT OPTION;

If you want to allow users to connect to the MySQL server from a host myuser IP 192.168.1.3 and use MyPassword as the password

GRANT all privileges on * * to ' myuser ' @ ' 192.168.1.3 ' identified by ' MyPassword ' with GRANT OPTION;

"The following sentence must be executed, or you will not be able to log in"

Mysql>flush privileges;

If the user cannot log on locally, this is the time to perform the following

GRANT all privileges on * * to ' root ' @ ' Localhost.localdomain ' identified by ' 123456 ' with GRANT OPTION;

Don't forget to add the following statement

Flush privileges;

Linux yum install 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.