Linux test Environment deployment MySQL (iii)

Source: Internet
Author: User
Tags mysql client

Installation configuration MySQL

1. Installation

See if you have 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 settings

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

To start the MySQL service:

Service mysqld start or/etc/init.d/mysqld start

Boot start:

Chkconfig--add mysqld, 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 it:

Service Mysqld Stop

3. Create a password

Mysqladmin-u root password 123456 Create root administrator (the first root account is not the default password, in order to secure the need to manually create a new password)

4. Login:

Mysql-u Root-p then enter the password again.

MySQL into MySQL

show databases; Show MySQL Database

Use MySQL to enter a specific database

Show tables; A table showing the database

5. Remote Access

Port number for open firewall

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

Show tables;

Update user set host= '% ' where user= ' root ' and host= ' localhost ';

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

If remote is not logged in, it's a firewall problem.

Turn off Firewall service iptables stop

You can then use the Navicat connection to access the

or the development of port 3306 can also reach the purpose of remote connection

Firewall Open 3306 Port

1. Open the firewall configuration file

Vi/etc/sysconfig/iptables

2. Add the following line

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

3. Restart the firewall

service  iptables restart

Note: The added open 3306-port statement must be preceded by the icmp-host-prohibited

Forgot Password:

Service Mysqld Stop

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

Mysql-u Root

Use MySQL

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

Flush privileges;

Quit

4. 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 and other commands)

Startup scripts

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

Uninstall MySQL

Yum-y Remove mysql*

Linux test Environment deployment MySQL (iii)

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.