###1. Mysql 服务器安装
####1.1 yum 安装Mysql数据库
yum 安装:
# yum install mysql database server# check the old mysql patch[root@tonytest ~]# yum list installed mysql*[root@tonytest ~]# rpm -qa | grep mysql*# if you have old mysql patch, please remove it[root@tonytest ~]# rpm -e --allmatches mysql-5.0.95-5.el5_9#check the mysql patch on the yum repo[root@tonytest ~]# yum list mysql*# install the mysql client[root@tonytest ~]# yum install mysqlDependencies Resolved================================================================================ Package Arch Version Repository Size================================================================================Installing: mysql i386 5.0.95-5.el5_9 base 4.9 M mysql x86_64 5.0.95-5.el5_9 base 4.9 MTransaction Summary================================================================================[root@tonytest ~]# yum install mysql-devel#install the mysql server[root@tonytest ~]# yum install mysql-serverDependencies Resolved================================================================================ Package Arch Version Repository Size================================================================================Installing: mysql-server x86_64 5.0.95-5.el5_9 base 9.9 MInstalling for dependencies: perl-DBD-MySQL x86_64 3.0007-2.el5 base 148 k#startup the mysql database[root@tonytest ~]# /etc/init.d/mysqld start#modify the root password[root@tonytest ~]# /usr/bin/mysqladmin -u root password 'pass'
####1.2 rpm 安装Mysql数据库
rpm 安装:
http://dev.mysql.com/downloads/mysql/[root@mydb1 mysql]# lltotal 111476-rwx------ 1 root root 23163988 Dec 16 09:20 MySQL-client-5.6.22-1.linux_glibc2.5.x86_64.rpm-rwx------ 1 root root 88568583 Dec 16 09:20 MySQL-server-5.6.22-1.linux_glibc2.5.x86_64.rpm-rwx------ 1 root root 2412480 Dec 16 09:20 MySQL-shared-5.6.22-1.linux_glibc2.5.x86_64.rpm如果安装MySQL软件包时出现从属错误(例如,“error: removing these packages would break dependencies: libmysqlclient.so.10 is needed by ..”),你还应当安装包MySQL-shared-compat,其中包括两个向后兼容的共享库(MySQL 4.0为libmysqlclient.so.12,MySQL 3.23为libmysqlclient.so.10)。[root@mydb1 mysql]# rpm -ivh MySQL-server-5.6.22-1.linux_glibc2.5.x86_64.rpmPreparing... ########################################### [100%] 1:MySQL-server ########################################### [100%][root@mydb1 mysql]# rpm -ivh MySQL-client-5.6.22-1.linux_glibc2.5.x86_64.rpmPreparing... ########################################### [100%] 1:MySQL-client ########################################### [100%] [root@mydb1 mysql]# rpm -ivh MySQL-server-5.6.22-1.linux_glibc2.5.x86_64.rpmPreparing... ########################################### [100%] 1:MySQL-server ########################################### [100%]2014-12-16 10:07:00 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2014-12-16 10:07:00 12887 [Note] InnoDB: Using atomics to ref count buffer pool pages2014-12-16 10:07:00 12887 [Note] InnoDB: The InnoDB memory heap is disabled2014-12-16 10:07:00 12887 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins2014-12-16 10:07:00 12887 [Note] InnoDB: Memory barrier is not used2014-12-16 10:07:00 12887 [Note] InnoDB: Compressed tables use zlib 1.2.32014-12-16 10:07:00 12887 [Note] InnoDB: Using Linux native AIO2014-12-16 10:07:00 12887 [Note] InnoDB: Using CPU crc32 instructions2014-12-16 10:07:00 12887 [Note] InnoDB: Initializing buffer pool, size = 128.0M2014-12-16 10:07:00 12887 [Note] InnoDB: Completed initialization of buffer pool2014-12-16 10:07:00 12887 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!2014-12-16 10:07:00 12887 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB2014-12-16 10:07:00 12887 [Note] InnoDB: Database physically writes the file full: wait...2014-12-16 10:07:00 12887 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB2014-12-16 10:07:01 12887 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB2014-12-16 10:07:01 12887 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile02014-12-16 10:07:01 12887 [Warning] InnoDB: New log files created, LSN=457812014-12-16 10:07:01 12887 [Note] InnoDB: Doublewrite buffer not found: creating new2014-12-16 10:07:01 12887 [Note] InnoDB: Doublewrite buffer created2014-12-16 10:07:01 12887 [Note] InnoDB: 128 rollback segment(s) are active.2014-12-16 10:07:01 12887 [Warning] InnoDB: Creating foreign key constraint system tables.2014-12-16 10:07:01 12887 [Note] InnoDB: Foreign key constraint system tables created2014-12-16 10:07:01 12887 [Note] InnoDB: Creating tablespace and datafile system tables.2014-12-16 10:07:01 12887 [Note] InnoDB: Tablespace and datafile system tables created.2014-12-16 10:07:01 12887 [Note] InnoDB: Waiting for purge to start2014-12-16 10:07:01 12887 [Note] InnoDB: 5.6.22 started; log sequence number 0A random root password has been set. You will find it in '/root/.mysql_secret'.2014-12-16 10:07:02 12887 [Note] Binlog end2014-12-16 10:07:02 12887 [Note] InnoDB: FTS optimize thread exiting.2014-12-16 10:07:02 12887 [Note] InnoDB: Starting shutdown...2014-12-16 10:07:03 12887 [Note] InnoDB: Shutdown completed; log sequence number 16259772014-12-16 10:07:03 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2014-12-16 10:07:03 12909 [Note] InnoDB: Using atomics to ref count buffer pool pages2014-12-16 10:07:03 12909 [Note] InnoDB: The InnoDB memory heap is disabled2014-12-16 10:07:03 12909 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins2014-12-16 10:07:03 12909 [Note] InnoDB: Memory barrier is not used2014-12-16 10:07:03 12909 [Note] InnoDB: Compressed tables use zlib 1.2.32014-12-16 10:07:03 12909 [Note] InnoDB: Using Linux native AIO2014-12-16 10:07:03 12909 [Note] InnoDB: Using CPU crc32 instructions2014-12-16 10:07:03 12909 [Note] InnoDB: Initializing buffer pool, size = 128.0M2014-12-16 10:07:03 12909 [Note] InnoDB: Completed initialization of buffer pool2014-12-16 10:07:03 12909 [Note] InnoDB: Highest supported file format is Barracuda.2014-12-16 10:07:03 12909 [Note] InnoDB: 128 rollback segment(s) are active.2014-12-16 10:07:03 12909 [Note] InnoDB: Waiting for purge to start2014-12-16 10:07:03 12909 [Note] InnoDB: 5.6.22 started; log sequence number 16259772014-12-16 10:07:03 12909 [Note] Binlog end2014-12-16 10:07:03 12909 [Note] InnoDB: FTS optimize thread exiting.2014-12-16 10:07:03 12909 [Note] InnoDB: Starting shutdown...2014-12-16 10:07:05 12909 [Note] InnoDB: Shutdown completed; log sequence number 1625987A 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_installationwhich 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.comSupport MySQL by buying support/licenses at http://shop.mysql.comWARNING: Found existing config file /usr/my.cnf on the system.Because this file might be in use, it was not replaced,but was used in bootstrap (unless you used --defaults-file)and when you later start the server.The new default config file was created as /usr/my-new.cnf,please compare it with your file and take the changes you need.[root@mydb1 mysql]# rpm -ivh MySQL-client-5.6.22-1.linux_glibc2.5.x86_64.rpmPreparing... ########################################### [100%] 1:MySQL-client ########################################### [100%][root@mydb1 mysql]# more /root/.mysql_secret# The random password set for the root user at Tue Dec 16 10:07:02 2014 (local time): XZLUY_kM6jQEJrUf[root@mydb1 mysql]# mysql -u root -pEnter password:XZLUY_kM6jQEJrUfWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.6.22Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('pass');Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)mysql> exit[root@mydb1 mysql]# mysql -u root -ppassWarning: Using a password on the command line interface can be insecure.Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.6.22 MySQL Community Server (GPL)Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> exit