Reprint Please specify source:http://blog.csdn.net/guoyjoe/article/details/44753455
First, check if MySQL is installed on the operating system
[[email protected] backup]# rpm-qa |grep MySQL
Qt-mysql-4.6.2-26.el6_4.x86_64
Mysql-5.1.71-1.el6.x86_64
Mysql-server-5.1.71-1.el6.x86_64
Mysql-devel-5.1.71-1.el6.x86_64
Mysql-libs-5.1.71-1.el6.x86_64
Second, delete myql (redhat6.3 server comes with the mysql-libs is mysql-libs-5.1.61-4.el6.x86_64, May and the higher version of the mysql-libs conflict)
Yum Remove Mysql-libs
Third, rpm install MySQL (install with root user, do not need to build MySQL group and MySQL user in advance, install Mysql-server process will be created automatically)
[Email protected] backup]# RPM-PQL mysql-server-5.6.23-1.el6.x86_64.rpm | More
[Email protected] backup]# RPM-IVH mysql-server-5.6.23-1.el6.i686.rpm
[Email protected] backup]# RPM-IVH mysql-client-5.6.23-1.el6.x86_64.rpm
Iv. Creating the installation directory
Mkdir-p/u01/app/mysql/data/mysql3306/data
Mkdir-p/u01/app/mysql/data/mysql3306/log
Mkdir-p/u01/app/mysql/log/mysql3306/iblog
Mkdir-p/u01/app/mysql/log/mysql3306/binlog
Mkdir-p/u01/app/mysql/data/mysql3306/tmp
V. Configuration MY.CNF
Cp/usr/my.cnf/u01/app/mysql/data/mysql3306/my.cnf
Vi/u01/app/mysql/data/mysql3306/my.cnf
[Client]
port=3306
Socket=/u01/app/mysql/data/mysql3306/run/mysql.sock
[MySQL]
port=3306
Promprt=\\[email protected]\\d \\r:\\m:\\s>
[Mysqld]
Default-storage-engine=innodb
Character-set-server=utf8
Explicit_defaults_for_timestamp=true
#dir
Innodb_log_group_home_dir=/u01/app/mysql/log/mysql3306/iblog
Innodb_data_home_dir=/u01/app/mysql/log/mysql3306/iblog
Basedir=/usr
Datadir=/u01/app/mysql/data/mysql3306/data
Tmpdir=/u01/app/mysql/data/mysql3306/tmp
Slave_load_tmpdir=/u01/app/mysql/data/mysql3306/tmp
Log-error=/u01/app/mysql/data/mysql3306/log/alert.log
Slow_query_log_file=/u01/app/mysql/data/mysql3306/log/slow.log
Relay_log_info_file=/u01/app/mysql/log/mysql3306/binlog/relay-log.info
Master-info-file=/u01/app/mysql/log/mysql3306/binlog/master.info
Socket=/u01/app/mysql/data/mysql3306/run/mysql.sock
Log-bin=/u01/app/mysql/log/mysql3306/binlog/binlog
Relay-log=/u01/app/mysql/log/mysql3306/binlog/relaylog
Innodb_force_recovery=0
Iv. Execute MySQL installation script
SH init3306.sh
rm-rf/u01/app/mysql/mysql3306/data/*
rm-rf/u01/app/mysql/log/mysql3306/iblog/*
rm-rf/u01/app/mysql/log/mysql3306/binlog/*
Chmod-r 777/u01/app/mysql/data/mysql/3306/data/*
Chmod-r 777/u01/app/mysql/log/mysql3306/iblog/*
Chmod-r 777/u01/app/mysql/log/mysql3306/binlog/*
chmod 755/u01/app/mysql/data/mysql3306/my.cnf
mysql_install_db--defaults-file=/u01/app/mysql/data/mysql3306/my.cnf--basedir=/usr/--datadir=/u01/app/mysql/ Data/mysql3306/data
V. Check if there is a MySQL service, such as not adding MySQL to the service boot start
Chkconfig--add mysqld
Chkconfig--level 2345 mysqld on
See if the boot setting is successful
[Email protected] ~]# Chkconfig--list | grep MySQL
MySQL 0:off 1:off 2:on 3:on 4:on 5:on 6:off
VI. Start MySQL
[[Email protected] ~]# service MySQL start
Starting MySQL success!
Vii. ways to view MySQL running state
[[Email protected] ~]# service MySQL status
success! MySQL Running (4104)
Eight, check MySQL initial password
[Email protected] ~]# Cat/root/.mysql_secret
# The random password set for the root user at Mon Mar 15:04:58 (local time): B15XIBTQ3XAOGRVX
Nine, login MySQL
[Email protected] ~]# mysql-u root-p
Enter Password:
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 6
Server version:5.6.23
Copyright (c), Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Mysql>
Ten, change the password
mysql> show databases;
ERROR 1820 (HY000): Must SET PASSWORD before executing this statement
mysql> SET PASSWORD = PASSWORD (' guoyJoe123 ');
Query OK, 0 rows Affected (0.00 sec)
mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| Information_schema |
| MySQL |
| Performance_schema |
| Test |
+--------------------+
4 rows in Set (0.00 sec)
If you want to access the root user remotely, such as the command!
Mysql>grant all privileges on * * to ' root ' @ '% ' identified by ' guoyJoe123 ' with GRANT OPTION;
Use RPM package to teach you to install MySQL (mysql-server-5.6.23 for Centos6.5_64bit)