Learn mysql-install MySQL on Linux using yum

Source: Internet
Author: User

1. Check the MySQL information that is already installed

Yum List installed mysql*
Rpm-qa | grep mysql*

2. List installed and installable MySQL information

Yum List mysql*

3. Installing the Client

Yum install MySQL

4. Install server-side

Yum Install Mysql-server

Yum Install Mysql-devel

5. Database Character Set settings

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

You can use the following command to view the MySQL global encoding format

mysql> SHOW VARIABLES like ' character% ';
+--------------------------+----------------------------+
| variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | UTF8 |
| character_set_connection | UTF8 |
| Character_set_database | UTF8 |
| Character_set_filesystem | binary |
| Character_set_results | UTF8 |
| Character_set_server | UTF8 |
| Character_set_system | UTF8 |
| Character_sets_dir | /usr/share/mysql/charsets/|
+--------------------------+----------------------------+
8 rows in Set (2.05 sec)

mysql> SHOW VARIABLES like ' collation% ';
+----------------------+-----------------+
| variable_name | Value |
+----------------------+-----------------+
| collation_connection | Utf8_general_ci |
| Collation_database | Utf8_general_ci |
| Collation_server | Utf8_general_ci |
+----------------------+-----------------+
3 rows in Set (0.43 sec)


If you do not successfully turn the encoding into Utf-8, you can also use the following command to go.
mysql> SET character_set_client = UTF8;
mysql> SET character_set_connection = UTF8;
mysql> SET character_set_database = UTF8;
mysql> SET character_set_results = UTF8;
mysql> SET character_set_server = UTF8;

mysql> SET collation_connection = utf8_general_ci;
mysql> SET collation_database = utf8_general_ci;
mysql> SET collation_server = utf8_general_ci;

6. Start

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

7. Stop

Service Mysqld Stop

8. Boot up

Chkconfig--add mysqld

Check if you have successfully configured boot using the following command

Chkconfig--list | grep mysql*

Mysqld 0: Off 1: Off 2: Enable 3: Enable 4: Enable 5: Enable 6: Off

9. Log in to MySQL

Mysql-u root-p

Initial default root no password

10. Forgot password

Service Mysqld Stop

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

Mysql-u Root

Mysql>use MySQL

Mysql>update User Set Password=password ("New_pass") where user= "root";

Mysql>flush privileges;

11. Remote Access


Port number of the open firewall, default port is 3306
MySQL Add permission: The user table in the MySQL library has a new record of "%" and the user is "root".

GRANT all privileges on *. * to ' root ' @ '% ' identified by ' qyf404 ' with GRANT OPTION max_queries_per_hour 0 max_connections_per_hour 0 max_updates_per _hour 0;

Several important directories for 12.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)

Learn mysql-install MySQL on Linux using yum

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.