1、上传并解压mysql安装包 MySQL-5.6.23-1.rhel5.i386.rpm-bundle.tar
[hadoop@mdw mysql]$ cp /mnt/cdrom/MySQL-5.6.23-1.rhel5.i386.rpm-bundle.tar .
[hadoop@mdw mysql]$ tar xf MySQL-5.6.23-1.rhel5.i386.rpm-bundle.tar
2、使用root账户安装mysql
[root@mdw mysql]# rpm -ivh MySQL-server-5.6.23-1.rhel5.i386.rpm
如果报以下错误,解决方法参考linux安装MySQL 5.6.10包冲突问题导致安装失败的问题
Preparing... ########################################### [100%]
file /usr/share/mysql/charsets/README from install of MySQL-server-5.6.23-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-5.6.23-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
file /usr/share/mysql/danish/errmsg.sys from install of MySQL-server-5.6.23-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.66-2.el6_3.i686
处理后冲突重新安装mysql
[root@mdw mysql]# rpm -ivh MySQL-server-5.6.23-1.rhel5.i386.rpm
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
warning: user mysql does not exist - using root
warning: group mysql does not exist - using root
2015-06-06 06:42:24 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-06-06 06:42:24 3337 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2015-06-06 06:42:24 3337 [Note] InnoDB: The InnoDB memory heap is disabled
2015-06-06 06:42:24 3337 [Note] InnoDB: Mutexes and rw_locks use InnoDB's own implementation
2015-06-06 06:42:24 3337 [Note] InnoDB: Memory barrier is not used
2015-06-06 06:42:24 3337 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-06-06 06:42:24 3337 [Note] InnoDB: Using Linux native AIO
2015-06-06 06:42:24 3337 [Note] InnoDB: Not using CPU crc32 instructions
2015-06-06 06:42:24 3337 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-06-06 06:42:24 3337 [Note] InnoDB: Completed initialization of buffer pool
2015-06-06 06:42:24 3337 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2015-06-06 06:42:24 3337 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2015-06-06 06:42:24 3337 [Note] InnoDB: Database physically writes the file full: wait...
2015-06-06 06:42:24 3337 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2015-06-06 06:42:25 3337 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2015-06-06 06:42:27 3337 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2015-06-06 06:42:27 3337 [Warning] InnoDB: New log files created, LSN=45781
2015-06-06 06:42:27 3337 [Note] InnoDB: Doublewrite buffer not found: creating new
2015-06-06 06:42:27 3337 [Note] InnoDB: Doublewrite buffer created
2015-06-06 06:42:27 3337 [Note] InnoDB: 128 rollback segment(s) are active.
2015-06-06 06:42:27 3337 [Warning] InnoDB: Creating foreign key constraint system tables.
2015-06-06 06:42:27 3337 [Note] InnoDB: Foreign key constraint system tables created
2015-06-06 06:42:27 3337 [Note] InnoDB: Creating tablespace and datafile system tables.
2015-06-06 06:42:27 3337 [Note] InnoDB: Tablespace and datafile system tables created.
2015-06-06 06:42:27 3337 [Note] InnoDB: Waiting for purge to start
2015-06-06 06:42:27 3337 [Note] InnoDB: 5.6.23 started; log sequence number 0
A random root password has been set. You will find it in '/root/.mysql_secret'.
2015-06-06 06:42:28 3337 [Note] Binlog end
2015-06-06 06:42:28 3337 [Note] InnoDB: FTS optimize thread exiting.
2015-06-06 06:42:28 3337 [Note] InnoDB: Starting shutdown...
2015-06-06 06:42:29 3337 [Note] InnoDB: Shutdown completed; log sequence number 1625977
2015-06-06 06:42:29 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-06-06 06:42:29 3359 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2015-06-06 06:42:29 3359 [Note] InnoDB: The InnoDB memory heap is disabled
2015-06-06 06:42:29 3359 [Note] InnoDB: Mutexes and rw_locks use InnoDB's own implementation
2015-06-06 06:42:29 3359 [Note] InnoDB: Memory barrier is not used
2015-06-06 06:42:29 3359 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-06-06 06:42:29 3359 [Note] InnoDB: Using Linux native AIO
2015-06-06 06:42:29 3359 [Note] InnoDB: Not using CPU crc32 instructions
2015-06-06 06:42:29 3359 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-06-06 06:42:29 3359 [Note] InnoDB: Completed initialization of buffer pool
2015-06-06 06:42:29 3359 [Note] InnoDB: Highest supported file format is Barracuda.
2015-06-06 06:42:29 3359 [Note] InnoDB: 128 rollback segment(s) are active.
2015-06-06 06:42:29 3359 [Note] InnoDB: Waiting for purge to start
2015-06-06 06:42:29 3359 [Note] InnoDB: 5.6.23 started; log sequence number 1625977
2015-06-06 06:42:29 3359 [Note] Binlog end
2015-06-06 06:42:29 3359 [Note] InnoDB: FTS optimize thread exiting.
2015-06-06 06:42:29 3359 [Note] InnoDB: Starting shutdown...
2015-06-06 06:42:31 3359 [Note] InnoDB: Shutdown completed; log sequence number 1625987
A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.
You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.
Also, the account for the anonymous user has been removed.
In addition, you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test database.
This is strongly recommended for production servers.
See the manual for more instructions.
Please report any problems at http://bugs.mysql.com/
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
[root@mdw mysql]#
mysql的server安装完成后,会随机生成一个密码,密码放在/root/.mysql_secret文件中,如上面红色部分,查看该文件:
[root@mdw mysql]# cat /root/.mysql_secret
# The random password set for the root user at Sat Jun 6 06:42:28 2015 (local time): ql2NNQ3RnBiuz3aE
3、安装mysql的client和mysql devel
[root@mdw mysql]# rpm -ivh MySQL-client-5.6.23-1.rhel5.i386.rpm
Preparing... ########################################### [100%]
1:MySQL-client ########################################### [100%]
[root@mdw mysql]# rpm -ivh MySQL-devel-5.6.23-1.rhel5.i386.rpm
Preparing... ########################################### [100%]
1:MySQL-devel ########################################### [100%]
4、启动mysql服务
[root@mdw mysql]# service mysql start
Starting MySQL.. SUCCESS!
5、登录mysql server并修改root密码
[root@mdw mysql]# mysql -uroot -p
Enter password: 【输入刚才生成的密码】
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.23
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> set password=password('123456');
Query OK, 0 rows affected (0.04 sec)
mysql>
到此mysql已成功安装,并将root的密码设置成了123456