{"id":6299,"date":"2016-09-18T12:51:15","date_gmt":"2016-09-18T04:51:15","guid":{"rendered":"http:\/\/rmohan.com\/?p=6299"},"modified":"2016-09-18T12:51:15","modified_gmt":"2016-09-18T04:51:15","slug":"centos7-under-yum-successfully-installed-mysql-5-7","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6299","title":{"rendered":"CentOS7 under yum successfully installed MySQL 5.7"},"content":{"rendered":"<p>1. Download the YUM library<\/p>\n<p>shell&gt; wget http:\/\/dev.mysql.com\/get\/mysql57-community-release-el7-7.noarch.rpm<\/p>\n<p>2. Install YUM library<\/p>\n<p>shell&gt; yum localinstall -y mysql57-community-release-el7-7.noarch.rpm<\/p>\n<p>3. Install Database<\/p>\n<p>shell&gt; yum install -y mysql-community-server<\/p>\n<p>4. Start MySQL service<\/p>\n<p>shell&gt; systemctl start mysqld.service<\/p>\n<p>5. The default blank password<\/p>\n<p>shell&gt; mysql -uroot -p<\/p>\n<p>6. Reset the root password to restart the mysql service<\/p>\n<p>shell&gt; update mysql.user set authentication_string = password ( &#8220;yourpassword&#8221;) where user = &#8220;root&#8221; and Host = &#8220;localhost&#8221;;<\/p>\n<p>shell&gt; flush privileges;<\/p>\n<p>shell&gt; quit;<\/p>\n<p>shell&gt; systemctl restart mysqld;<\/p>\n<p>If the hand cheap or do not know what reason the following questions arise:<\/p>\n<p>ERROR 1045 (28000): Access denied for user &#8216;root&#8217; @ &#8216;localhost&#8217; (using password: NO)<\/p>\n<p>Please edit my.cnf, add the skip-grant-tables and skip-networking:<\/p>\n<p>shell&gt; vi \/etc\/my.cnf<\/p>\n<p>[Mysqld]<\/p>\n<p>skip-grant-tables<\/p>\n<p>skip-networking<\/p>\n<p>Restart mysql, and then repeat the above steps to change the password, remember to modify finished, remove the two lines of my.cnf add.<\/p>\n<p>Part II: Configuration<\/p>\n<p>1, add a remote login user (login Mysql)<\/p>\n<p>use mysql;<\/p>\n<p>. GRANT ALL PRIVILEGES ON * * TO &#8216;root&#8217; @ &#8216;%&#8217; IDENTIFIED BY &#8216;your password&#8217; WITH GRANT OPTION;<\/p>\n<p>Note: &#8216;%&#8217; represents any address, you can specify IP<\/p>\n<p>2, check the user table, memory refresh permission<\/p>\n<p>select host, user from user;<\/p>\n<p>FLUSH PRIVILEGES;<\/p>\n<p>3, set the firewall (CentOS7 not recommended)<\/p>\n<p>vi \/ etc \/ sysconfig \/ iptables<\/p>\n<p>Before -A RH-Firewall-1-INPUT -j REJECT -reject-with icmp-host-prohibited, add<\/p>\n<p>-A INPUT -m state &#8211;state NEW -m tcp -p tcp &#8211;dport 3306 -j ACCEPT<\/p>\n<p>Restart the firewall<\/p>\n<p>service iptables restart<\/p>\n<p>NOTE: centos7 using a firewall Firewall<\/p>\n<p>systemctl stop firewalld.service # Stop<\/p>\n<p>systemctl disable firewalld.service # disable<\/p>\n<p>4, set the character set and encoding are case sensitive<\/p>\n<p>4.1 modify the mysql configuration file (set the character set encoding)<\/p>\n<p>The default location: \/etc\/my.cnf<\/p>\n<p>Etc into the folder &gt;&gt; vim my.cnf<\/p>\n<p>[Mysqld]<\/p>\n<p>character-set-server = utf8<\/p>\n<p>collation-server = utf8_general_ci<\/p>\n<p>* Systemctl restart mysql.service # restart MySQL<\/p>\n<p>* View current mysql running state<\/p>\n<p>mysql&gt; status<\/p>\n<p>Parameter Description:<\/p>\n<p>haracter_set_client: character set the client requests data.<\/p>\n<p>character_set_connection: receives data from the client, and then transfers the character set.<\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n<p>character_set_results: character set of the result set.<\/p>\n<p>character_set_server: the default character set of the database server.<\/p>\n<p>character_set_system: This value is always utf8, no need to set the character set, the storage system metadata.<\/p>\n<p>4.2 modify the mysql configuration file (setting is case-sensitive)<\/p>\n<p>lower_case_table_names Detailed parameters:<\/p>\n<p>0: case sensitive<\/p>\n<p>1: case-insensitive<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Download the YUM library<\/p>\n<p>shell&gt; wget http:\/\/dev.mysql.com\/get\/mysql57-community-release-el7-7.noarch.rpm<\/p>\n<p>2. Install YUM library<\/p>\n<p>shell&gt; yum localinstall -y mysql57-community-release-el7-7.noarch.rpm<\/p>\n<p>3. Install Database<\/p>\n<p>shell&gt; yum install -y mysql-community-server<\/p>\n<p>4. Start MySQL service<\/p>\n<p>shell&gt; systemctl start mysqld.service<\/p>\n<p>5. The default blank password<\/p>\n<p>shell&gt; mysql -uroot -p<\/p>\n<p>6. Reset the root password to restart the mysql service<\/p>\n<p>shell&gt; update mysql.user [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6299"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6299"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6299\/revisions"}],"predecessor-version":[{"id":6300,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6299\/revisions\/6300"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}