CentOS6.8 Mysql installation configuration

1, mysql download the repo source

  wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

2, the installation mysql-community-release-el7-5.noarch.rpm package

  rpm -ivh mysql-community-release-el7-5.noarch.rpm

  After installing this package, you get yum repo source of two mysql: 

  /etc/yum.repos.d/mysql-community.repo and  /etc/yum.repos.d/mysql-community-source.repo.

   Installation yum install mysql-server

If the error:

 

 Solution: 1, vi MySQL-Community Community .repo

       2、找到mysql-56-community,enable置为0 enable=0;

          并重新安装    yum install mysql-server

 3, character set configuration (/etc/my.cnf)

  Added at [mysqld] node

    default-character-set=utf8

    character-set-server=utf8

  Save and exit: wq

4, Chinese garbled configuration, the configuration my.ini under windos

  (1) In version 5.1, within the my.ini [mysqld] and [mysql] are written:

    default-character-set=utf8

  (2) and written in such a version 5.5, mysql [], [] within mysqld can not, but:

    character-set-server=utf8

5, since the launch configuration

  (1) execute chkconfig mysqld on

  (2) performing chkconfig --list mysqld (see bits 2-5 is on, that is ok)

6, firewall configuration

  (1)sudo vi /etc/sysconfig/iptables

  (2) -A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT added to the inside

  (3) to restart the firewall service iptables restart

7, restart the mysql service mysqld restart

8, user configuration

  (1) view the current user select user, host, password from mysql.user;

  (2) delete the anonymous user delete from mysql.user where user = "";

  (3) setting a password set password for root @ localhost = password ( 'yourpassword') is the root;

  (4)添加用户  insert into mysql.user(host,user,password) values('localhost','yourUserName',password('yourpassword'));

  (5)创建库  create database `databaseName` default character set utf8 collate utf8_general_ci;

  (6) local user privileges granted to all  

    grant all privileges on databaseName.* to yourusername@localhost identified by `yourpassword`;

    All rights to the account opened outside the network.

    grant all privileges on databaseName.* to yourusername@'%' identified by `yourpassword`;

    Combined with the actual situation decided to open what authority! ! !

    grant select,insert,update on databaseName.* to yourusername@'192.168.10.205' identified by `yourpassword`;

  (7) allows the operator to take effect flush privileges;

Guess you like

Origin www.cnblogs.com/baixiong/p/11849225.html