Reprint, http://blog.csdn.net/mw08091020/article/details/39234207a. Check if Linux has MySQL installed
Rpm-qa | Grep-i mysql# If you installed uninstall the old version first yum-y remove MySQL ...
B. Download the required installation package:
http://cdn.mysql.com/Downloads/MySQL-5.6/MySQL-client-5.6.20-1.el6.x86_64.rpmhttp://cdn.mysql.com/Downloads/ mysql-5.6/mysql-devel-5.6.20-1.el6.x86_64.rpmhttp://cdn.mysql.com/downloads/mysql-5.6/ mysql-server-5.6.20-1.el6.x86_64.rpm
C. Start installing individually
RPM-IVH MYSQL-SERVER-5.6.20-1.EL6.X86_64.RPMRPM-IVH MYSQL-DEVEL-5.6.20-1.EL6.X86_64.RPMRPM-IVH mysql-client-5.6.20-1.el6.x86_64.rpm
D. Modify the configuration file location and make the relevant settings
cp/usr/share/mysql/my-default.cnf/etc/my.cnfvi/etc/my.cnf# do the following configuration
E. Initializing MySQL and setting passwords
/usr/bin/mysql_install_dbservice MySQL Start
F. Login to MySQL, first load no password, direct enter
mysql-uroot-p# set the root user's password mysql> update user set Password=password (' 123456 ') where user= ' root ';
G. Setting allow remote logins
mysql> use mysql;mysql> Select Host,user,password from user;mysql> update user set host= '% ' where user= ' root ' and host= ' localhost ';mysql> flush privileges;mysql> exit;
H. Setting up boot from
Chkconfig MySQL onchkconfig--list | grep MySQL
I. mysql default installation location description
/var/lib/mysql/ #数据库目录/usr/share/mysql #配置文件目录/usr/bin #相关命令目录/etc/init.d/mysql #启动脚本 Note: When you uninstall MySQL, the files in these directories are also deleted.
J. Errors that may be encountered (i)
2014-01-21 06:03:29 14964 [ERROR] innodb:auto-extending data file./ibdata1 is of a different size 640 pages (rounded Dow N to MB) than specified in the. CNF file:initial 768 pages, Max 0 (relevant if non-zero) pages!2014-01-21 06:03:29 1 4964 [ERROR] innodb:could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit INNODB_DATA_FILE_PA Th in my.cnf and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, and did not yet with them in any. But is careful:do not remove old data files which contain your precious data!2014-01-21 06:03:29 14964 [ERROR] Plugin ' in Nodb ' init function returned error.2014-01-21 06:03:29 14964 [ERROR] Plugin ' InnoDB ' registration as a STORAGE ENGINE fail ed.2014-01-21 06:03:29 14964 [ERROR] unknown/unsupported storage engine:innodb2014-01-21 06:03:29 14964 [ERROR] Aborting In/var/lib/myDelete these three files in the sql/directory: ibdata1 ib_logfile0 ib_logfile1 then restart MYSQLCD/VAR/LIB/MYSQLRM ibdata1 ib_logfile0 ib_logfile1service MySQL Start
K. Possible errors (ii)
[Email protected] local]# mysql-uroot-penter password:error 1045 (28000): Access denied for user ' root ' @ ' localhost ' (u Sing Password:yes) method operation is very simple, as follows: #/etc/init.d/mysql stop# mysqld_safe--user=mysql--skip-grant-tables--skip-networking Mysql-u root mysql//The empty user password is changed to a non-empty password. mysql> UPDATE user SET Password=password (' NewPassword ') where user= ' root ' and host= ' root ' or host= ' localhost '; mysql& Gt FLUSH privileges;mysql> quit #/etc/init.d/mysqld restart# mysql-uroot-penter Password: < Enter new password newpassword>
L. Errors you may encounter (iii)
mysql> show databases; ERROR 1820 (HY000): Must set PASSWORD before executing this phrase requires you to reset your password again! mysql> SET PASSWORD = PASSWORD (' 123456 '); Query OK, 0 rows affected (0.03 sec) mysql> Create database Roger; Query OK, 1 row Affected (0.00 sec)
Reference: http://blog.csdn.net/liumm0000/article/details/18841197
CentOS6.5 and RedHat6.5 are installed in RPM mode mysql-5.6.20