0: Determine System Information:
[email protected] mysql]# cat/etc/issue
CentOS Release 6.4 (Final) Kernel \ r
on a \m
One: Yum mode installation
[email protected] ~]$ Yum list mysql*
Loaded plugins:downloadonly, fastestmirror, security
Determining fastest Mirrors
installed Packages
mysql-client.x86_64 5.6.21-1.el6 @custom
mysql-libs.x86_64 5.1.66-2.el6_3 @anaconda-centos-2013030201 51.x86_64/6.4
Available Packages
mysql-devel.x86 _64  5.6.21-1.EL6&N bsp; custom
mysql-python.x86 _64  1.2.3-0.3.C1.1.EL6&NB sp; base
mysql-server.x86_64 5.6.21-1.el6 Custom
# #安装server端 [email protected] ~]$ Yum install mysql-server
#安装client端 [[email protected] ~]$ yum install MySQL
if the installation process error, delete the MySQL-related lib, the command is as follows:; then perform the two steps of the above installation; [email protected] ~]$ Yum remove mysql*
Two: Know the installation directory of MySQL:2.1. Database directory/var/lib/mysql/
2.2. Configuration file/usr/share/mysql (mysql.server command and configuration file)
2.3, the relevant command/usr/bin (Mysqladmin mysqldump and other commands)
2.4.1, startup script 1/etc/rc.d/init.d/mysql (startup script file mysql directory) 2.4.2, startup script 2/etc/init.d/mysql (startup script file MySQL directory)
2.5mysql configuration file/usr/my.cnf (find out)
Three: Edit the contents of the/usr/my.cnf file as follows:
[email protected] mysql]# vi/usr/my.cnf # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html [Client] No-beep bind-address = 0.0.0.0 port=3306
[Mysqld] Datadir=/var/lib/mysql Socket=/var/lib/mysql/mysql.sock Character-set-server=utf8 Sql_mode=no_engine_substitution,strict_trans_tables Default-storage-engine=innodb #默认数据储存格式 max_connections=10 innodb_buffer_pool_size=256m #内存 query_cache_size=30m
[MySQL] default-character-set = UTF8
Four: Restart the MySQL service and modify the default password:1) mysqladmin-u root password ' newpassword ' Change passwordif there are errors as follows:
[[email protected "Mysql]#mysqladmin-u root password ' root '   error 1045 (28000): Access Denied for user ' root ' @ ' localhost ' (using password:no)
1, disable MySQL service: #/etc/rc.d/init.d/mysqld stop 2, input command: # mysqld_safe--user=mysql--skip-grant-tables--skip-networking & 3, login database: # mysql-u root mysql 4, mysql> use MySQL; mysql> UPDATE user SET Password=password (' root ') where user= ' root '; mysql> FLUSH privileges; mysql> quit 5, restart Service: #/etc/init.d/mysql Restart If you use the new username, the password login error is as follows:
mysql> show databases; ERROR 1820 (HY000): Must SET PASSWORD before executing this statement
6, in the execution:mysqladmin-u root-proot password ' root ' , so that the root user can normally use; # mysql-u Root-proot #即可正常使用数据了!
Five: start the MySQL service and set it to system service:
# chkconfig mysqld on← set up MySQL service with system boot self-boot
# chkconfig–list mysqld ← Confirm MySQL self-booting mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off← If 2–5 is on the status OK
#service mysqld start← Start Service (#/etc/rc.d/init.d/mysqld Start is also possible)
VI: Delete the anonymous user and the test database:
Delete from mysql.user where user= "; ← Delete anonymous user select user,host from Mysql.user; ← Viewing user Information
Select Version (), current_date; #当前版本信息, date and database: show databases; ← View the database that is already present in the system drop test; ← Deleting an empty database named Test
Installation guide for Mysql-server on CentOS (Linux installation MySQL combat guide)