1, check MySQL and related RPM package, whether installed, or removed if there is an installation.
Rpm-qa | Grep-i MySQL
Yum-y Remove mysql-libs*
2, according to the system download RPM package, I downloaded the Mysql-5.6.19-1.el6.i686.rpm-bundle.tar
Unzip the package and install it sequentially:
RPM-IVH mysql-server-5.6.19-1.el6.i686.rpm
RPM-IVH mysql-devel-5.6.19-1.el6.i686.rpm
RPM-IVH mysql-client-5.6.19-1.el6.i686.rpm
If you need to install Apache2+php5+mysql you need to install
mysql-embedded-5.6.19-1.el6.i686.rpm
mysql-shared-5.6.19-1.el6.i686.rpm
mysql-shared-compat-5.6.19-1.el6.i686.rpm
Otherwise compile PHP associated with MySQL will always error:
Configure:error:mysql Configure failed. Please check the Config.log for more information.
To modify a configuration file:
Cp/usr/share/mysql/my-default.cnf/etc/my.cnf
3, initialize MySQL and set password
/usr/bin/mysql_install_db
Service MySQL Start
Cat/root/.mysql_secret #查看root帐号初始密码
Mysql-uroot-ppassword # "Password" is the password that the above command looks at
Change Password after successful login:
Mysql>set PASSWORD =password (' 123456 ');
mysql>exit;
4, allow remote login
Mysql>use MySQL;
Mysql>select Host,usr,password from user;
Mysql>update user Set Password=password (' 123456 ') where user= ' root ';
Mysql>update user set host= '% ' where user= ' root ' and host= ' localshot '; #允许所有用户远程链接
Mysql>flush privileges;
Mysql>exit
5, set boot auto start
Chkconfig MySQL on
Chkconfig--list | grep MySQL #查看开机启动状态
6. Modify the/etc/my.cnf file
Increase:
[Client]
password=123456
port=3306
Socket=/var/lib/mysql/mysql.sock
Default-character-set=utf8
[Mysqld]
Port = 3306
Character_set_server=utf8
Character_set_client=utf8
Collation-server=utf8_general_ci
Lower_case_table_names=1
Socket=/var/lib/mysql/mysql.sock
max_connections=1000
After the last line sql_mode=no_engine_substitution,strict_trans_tables, add
[MySQL]
Default-character-set=utf8
At first I put [MySQL] and coding on sql_mode= ... Error running database in front
Mysql:unknown variable ' sql_mode=no_engine_substitution,strict_trans_tables '
Put it in sql_mode=. The database in the back runs normally.
7. View Character Set
Show variables like ' character% ';
Show variables like ' char% ';
8,mysql Default installation Location
View command: Whereis MySQL
/var/lib/mysql/#数据库目录
/usr/share/mysql #配置文件目录
/usr/bin #相关命令目录
/etc/init.d/mysql #启动脚本
/usr/include/mysql #mysql头文件位置
9, it is best to turn off the firewall, SeLinux
Service Iptables Stop
Chkconfig iptables off
Modify/etc/selinux/config
#SELINUX =enforcing #去掉
#SELINUXTYPE =targeted #去掉
Selinux=disabled #增加