Linux Online install MySQL and modify password settings service startup

Source: Internet
Author: User
Tags mysql client

First, Description: This culture and education everyone in the Linux online installation of MySQL. Many articles on the internet are too messy to write, we only take the most convenient way to install online. This article takes CentOS as an example.

Second, the installation process.

1. Install client and server:

(1) Check if you have installed:

Yum List installed mysql*

Rpm-qa | grep mysql*

(2) To see if there is an installation package:

Yum List mysql*

(3) Install the MySQL client:

Yum install MySQL

(4) Install MySQL server:

Yum Install Mysql-server

Yum Install Mysql-devel

Note: It is also possible to install only mysql-server.

Mysql-devel is some of the required libraries and include files if you want to compile other MySQL client programs, such as Perl modules.

(5) Setting character Set encoding:

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

2, start, stop the service.

(1) Start-up service:

Service mysqld Start

(2) Stop the service:

Service Mysqld Stop

(3) Set to boot automatically:

Chkconfig mysqld on

3, login and forget password processing.

(1) Create root administrator:

Mysqladmin-u Root Password 123456

(2) Log in to MySQL:

Mysql-u root-p

(3) If you forgot your password:

Service Mysqld Stop

Mysqld_safe--user=root--skip-grant-tables
Mysql-u Root
Use MySQL
Update user set Password=password ("123456") where user= "root";
Flush privileges;

4. Allow remote access settings.

  Use MySQL;

UPDATE user SET ' Host ' = '% ' WHERE ' user ' = ' root ' LIMIT 1;

5. Port number of open firewall

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

Use MySQL;
UPDATE user SET ' Host ' = '% ' WHERE ' user ' = ' root ' LIMIT 1;
% means all IP access is allowed

6. Several important directories of MySQL

(a) Database directory
/var/lib/mysql/
(b) configuration files
/usr/share/mysql (mysql.server command and configuration file)
(c) Related orders
/usr/bin (Mysqladmin mysqldump and other commands)
(d) Startup scripts
/etc/rc.d/init.d/(startup script file for MySQL directory)

  

Linux Online install MySQL and modify password settings service startup

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.