1. Download the YUM library

shell> wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm

2. Install YUM library

shell> yum localinstall -y mysql57-community-release-el7-7.noarch.rpm

3. Install Database

shell> yum install -y mysql-community-server

4. Start MySQL service

shell> systemctl start mysqld.service

5. The default blank password

shell> mysql -uroot -p

6. Reset the root password to restart the mysql service

shell> update mysql.user set authentication_string = password ( “yourpassword”) where user = “root” and Host = “localhost”;

shell> flush privileges;

shell> quit;

shell> systemctl restart mysqld;

If the hand cheap or do not know what reason the following questions arise:

ERROR 1045 (28000): Access denied for user ‘root’ @ ‘localhost’ (using password: NO)

Please edit my.cnf, add the skip-grant-tables and skip-networking:

shell> vi /etc/my.cnf

[Mysqld]

skip-grant-tables

skip-networking

Restart mysql, and then repeat the above steps to change the password, remember to modify finished, remove the two lines of my.cnf add.

Part II: Configuration

1, add a remote login user (login Mysql)

use mysql;

. GRANT ALL PRIVILEGES ON * * TO ‘root’ @ ‘%’ IDENTIFIED BY ‘your password’ WITH GRANT OPTION;

Note: ‘%’ represents any address, you can specify IP

2, check the user table, memory refresh permission

select host, user from user;

FLUSH PRIVILEGES;

3, set the firewall (CentOS7 not recommended)

vi / etc / sysconfig / iptables

Before -A RH-Firewall-1-INPUT -j REJECT -reject-with icmp-host-prohibited, add

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

Restart the firewall

service iptables restart

NOTE: centos7 using a firewall Firewall

systemctl stop firewalld.service # Stop

systemctl disable firewalld.service # disable

4, set the character set and encoding are case sensitive

4.1 modify the mysql configuration file (set the character set encoding)

The default location: /etc/my.cnf

Etc into the folder >> vim my.cnf

[Mysqld]

character-set-server = utf8

collation-server = utf8_general_ci

* Systemctl restart mysql.service # restart MySQL

* View current mysql running state

mysql> status

Parameter Description:

haracter_set_client: character set the client requests data.

character_set_connection: receives data from the client, and then transfers the character set.

character_set_database: default character set of the database, regardless of how to change the default database, all the character sets; if there is no default database, make character_set_server specified character set, no need to set this parameter.

character_set_filesystem: the operating system file name is converted to the character set that is character_set_client conversion character_set_filesystem, the default binary can.

character_set_results: character set of the result set.

character_set_server: the default character set of the database server.

character_set_system: This value is always utf8, no need to set the character set, the storage system metadata.

4.2 modify the mysql configuration file (setting is case-sensitive)

lower_case_table_names Detailed parameters:

0: case sensitive

1: case-insensitive

Leave a comment

Your email address will not be published. Required fields are marked *

Blue Captcha Image
Refresh

*

Protected by WP Anti Spam

Hit Counter provided by dental implants orange county