1. 1,调整最大文件数限制  

  2. ulimit -n  

  3. 1024          #这个是默认值  

  4. echo ulimit -n 65535 >>/etc/profile   

  5. source /etc/profile    #加载修改后的profile     

  6. ulimit -n     #显示65535,修改完毕!     

  7. 2,修改IO调度器设置    

  8. [root@mysql support-files]# cat /sys/block/sda/queue/scheduler   

  9. noop anticipatory [deadline] cfq                                #采用deadline的io调度器,重启后失效   

  10. title CentOS (2.6.32-220.el6.x86_64)  

  11.         root (hd0,0)  

  12.         kernel /boot/vmlinuz-2.6.32-220.el6.x86_64 ro root=UUID=5b4002c7-52b5-4749-8d87-ac61bacd0c8d rd_NO_LUKS rd_NO_LVM LANG=en_US  .UTF-8 rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 elevator=deadline numa=off rhgb crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_  

  13. DM  

  14.         initrd /boot/initramfs-2.6.32-220.el6.x86_64.img      #修改IO调度器和关闭numa,修改内核启动参数  

 3,修改swappiness设置  

  1. vi /etc/sysctl.conf    

  2. vm.swappiness = 0    

  3. sysctl -p   

  4. 4,磁盘分区及文件类型  

  5. /  根分区采用ext4  

  6. /opt 采用xfs    

  7. 查看磁盘分区的文件类型   

  8. [root@mysql ~]# parted  

  9. GNU Parted 2.1  

  10. Using /dev/sda  

  11. Welcome to GNU Parted! Type 'help' to view a list of commands.  

  12. (parted) p                                                                  

  13. Model: ATA VBOX HARDDISK (scsi)  

  14. Disk /dev/sda: 53.7GB  

  15. Sector size (logical/physical): 512B/512B  

  16. Partition Table: msdos    

  17. Number  Start   End     Size    Type     File system     Flags  

  18.  1      1049kB  24.3GB  24.3GB  primary  ext4            boot  

  19.  2      24.3GB  45.3GB  21.0GB  primary  xfs  

  20.  3      45.3GB  53.7GB  8389MB  primary  linux-swap(v1)    

  21. (parted)                  

  22. 6,手工安装gcc   

  23. rpm -ivh gcc-4.4.6-3.el6.x86_64.rpm cloog-ppl-0.15.7-1.2.el6.x86_64.rpm cpp-4.4.6-3.el6.x86_64.rpm glibc-devel-2.12-1.47.el6.x86_64.rpm \  

  24. libgomp-4.4.6-3.el6.x86_64.rpm mpfr-2.4.1-6.el6.x86_64.rpm ppl-0.10.2-11.el6.x86_64.rpm glibc-headers-2.12-1.47.el6.x86_64.rpm kernel-headers-2.6.32-220.el6.x86_64.rpm    

  25. 手工安装gcc-c++    

  26. rpm -ivh gcc-c++-4.4.6-3.el6.x86_64.rpm libstdc++-devel-4.4.6-3.el6.x86_64.rpm      

  27. tar xzvf cmakeXXXXX  

  28. tar zxvf percornaxxxxx 

  29. 安装cmake    

  30. cd ~/cmake    

  31. ./bootstrap     

  32. #检查无误后安装    

  33. make && make install    

  34. 检查是否安装成功:  

  35. 输入shell命令: cmake --version  

  36. 给出一下信息表示安装成功:cmake version 2.8.10.2   

  37. cmake 会默认安装在 /usr/local/bin 下面  

  38. 要改变安装路径,在bootstrap命令中加入'--prefix=PATH'选项。

  39. 安装percorna server    

  40. #建立安装目录和数据存放目录  

  41. mkdir -p /opt/mysql    

  42. mkdir -p /opt/mysql/data    

  43. cd /opt/mysql    

  44. mkdir run data tmp logs    

  45. chown -R mysql:mysql /opt/mysql

  46. 安装    

  47. tar zxvf Percona-Server-5.6.15-rel63.0.tar.gz    

  48. cd Percona-Server-5.6.15    

  49. cmake . -LH    

  50. cmake .  \    

  51. -DCMAKE_INSTALL_PREFIX=/opt/mysql \ #设置程序安装路径    

  52. -DMYSQL_DATADIR=/opt/mysql/data \ #设置数据存放路径    

  53. -DSYSCONFDIR=/etc \     

  54. -DWITH_MYISAM_STORAGE_ENGINE=1 \ #启用MYISAM存储引擎    

  55. -DWITH_INNOBASE_STORAGE_ENGINE=1 \    

  56. -DWITH_ARCHIVE_STORAGE_ENGINE=1 \    

  57. -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \    

  58. -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \    

  59. -DWITH_FEDERATED_STORAGE_ENGINE=1  \    

  60. -DWITH_READLINE=1 \ #启用MySQL快捷键    

  61. -DMYSQL_UNIX_ADDR=/opt/mysql/run/mysqld.sock \ #设置套接字存放位置    

  62. -DMYSQL_TCP_PORT=3306  \ #设置开放端口    

  63. -DENABLED_LOCAL_INFILE=1  \ #设置读取本地文件    

  64. -DWITH_PARTITION_STORAGE_ENGINE=1 \    

  65. -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 \ #默认字符串    

  66. -DDEFAULT_COLLATION=utf8_general_ci #默认检验规则     

  67. cmake .  -DCMAKE_INSTALL_PREFIX=/opt/mysql -DMYSQL_DATADIR=/opt/mysql/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 \  

  68. -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/opt/mysql/run/mysqld.sock \  

  69. -DWITH_ARCHIVE_STORAGE_ENGINE=1 \  

  70. -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci  

  71.   

  72. make  && make install 

  73. 初始化数据库:    

  74. /opt/mysql/scripts/mysql_install_db --basedir=/opt/mysql --datadir=/opt/mysql/data --user=mysql

  75. 4种启动方式:  

  76. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 

  77. 第一种:mysql.server  

  78. service mysqld start/stop/restart    

  79. /root/percona-server-5.6.20-68.0/support-files/mysql.server /etc/init.d/mysqld   

  80. chmod +x /etc/init.d/mysqld    

  81. vi /etc/init.d/mysqld    

  82. 修改以下参数  

  83. basedir=/opt/mysql  

  84. datadir=/opt/mysql/data    

  85. [root@mysql support-files]# service mysqld start  

  86. Starting MySQL (Percona Server). SUCCESS!   

  87. [root@mysql support-files]# service mysqld stop  

  88. Shutting down MySQL (Percona Server).. SUCCESS!   

  89. [root@mysql support-files]# service mysqld restart  

  90.  ERROR! MySQL (Percona Server) PID file could not be found!  

  91. Starting MySQL (Percona Server). SUCCESS!   

  92. [root@mysql support-files]# 

  93. 注意查看error log中的mysql启动日志  

  94. 140913 15:16:07 mysqld_safe mysqld from pid file /opt/mysql/data/mysql.pid ended  

  95. 140913 15:16:12 mysqld_safe Starting mysqld daemon with databases from /opt/mysql/data  

  96. 2014-09-13 15:16:12 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).  

  97. 2014-09-13 15:16:12 22831 [Note] Plugin 'FEDERATED' is disabled.  

  98. 2014-09-13 15:16:12 22831 [Note] InnoDB: Using atomics to ref count buffer pool pages  

  99. 2014-09-13 15:16:12 22831 [Note] InnoDB: The InnoDB memory heap is disabled  

  100. 2014-09-13 15:16:12 22831 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins  

  101. 2014-09-13 15:16:12 22831 [Note] InnoDB: Memory barrier is not used  

  102. 2014-09-13 15:16:12 22831 [Note] InnoDB: Compressed tables use zlib 1.2.3  

  103. 2014-09-13 15:16:12 22831 [Note] InnoDB: Not using CPU crc32 instructions  

  104. 2014-09-13 15:16:12 22831 [Note] InnoDB: Initializing buffer pool, size = 128.0M  

  105. 2014-09-13 15:16:12 22831 [Note] InnoDB: Completed initialization of buffer pool  

  106. 2014-09-13 15:16:12 22831 [Note] InnoDB: Highest supported file format is Barracuda.  

  107. 2014-09-13 15:16:12 22831 [Note] InnoDB: 128 rollback segment(s) are active.  

  108. 2014-09-13 15:16:12 22831 [Note] InnoDB: Waiting for purge to start  

  109. 2014-09-13 15:16:12 22831 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.20-68.0 started; log sequence number 1626047  

  110. 2014-09-13 15:16:12 22831 [Note] Server hostname (bind-address): '*'; port: 3306  

  111. 2014-09-13 15:16:12 22831 [Note] IPv6 is available.  

  112. 2014-09-13 15:16:12 22831 [Note]   - '::' resolves to '::';  

  113. 2014-09-13 15:16:12 22831 [Note] Server socket created on IP: '::'.  

  114. 2014-09-13 15:16:12 22831 [Note] Event Scheduler: Loaded 0 events  

  115. 2014-09-13 15:16:12 22831 [Note] /opt/mysql/bin/mysqld: ready for connections.  

  116. Version: '5.6.20-68.0'  socket: '/opt/mysql/run/mysqld.sock'  port: 3306  Source distribution 

  117. mysql的关闭日志  

  118.   

  119. 2014-09-13 15:17:16 22831 [Note] /opt/mysql/bin/mysqld: Normal shutdown  

  120.   

  121. 2014-09-13 15:17:16 22831 [Note] Giving 0 client threads a chance to die gracefully  

  122. 2014-09-13 15:17:16 22831 [Note] Event Scheduler: Purging the queue. 0 events  

  123. 2014-09-13 15:17:16 22831 [Note] Shutting down slave threads  

  124. 2014-09-13 15:17:16 22831 [Note] Forcefully disconnecting 0 remaining clients  

  125. 2014-09-13 15:17:16 22831 [Note] Binlog end  

  126. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'partition'  

  127. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'BLACKHOLE'  

  128. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_CHANGED_PAGES'  

  129. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'  

  130. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'  

  131. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'  

  132. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'  

  133. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'  

  134. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'  

  135. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'  

  136. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'  

  137. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_SYS_TABLES'  

  138. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'  

  139. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'  

  140. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_FT_CONFIG'  

  141. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'  

  142. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_FT_DELETED'  

  143. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'  

  144. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_METRICS'  

  145. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'  

  146. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'  

  147. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'  

  148. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'  

  149. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'  

  150. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'  

  151. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_CMPMEM'  

  152. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_CMP_RESET'  

  153. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_CMP'  

  154. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'  

  155. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_LOCKS'  

  156. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'INNODB_TRX'  

  157. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'XTRADB_RSEG'  

  158. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'XTRADB_INTERNAL_HASH_TABLES'  

  159. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'XTRADB_READ_VIEW'  

  160. 2014-09-13 15:17:16 22831 [Note] Shutting down plugin 'InnoDB'  

  161. 2014-09-13 15:17:16 22831 [Note] InnoDB: FTS optimize thread exiting.  

  162. 2014-09-13 15:17:16 22831 [Note] InnoDB: Starting shutdown...  

  163. 2014-09-13 15:17:17 22831 [Note] InnoDB: Shutdown completed; log sequence number 1626057  

  164. 2014-09-13 15:17:17 22831 [Note] Shutting down plugin 'ARCHIVE'  

  165. 2014-09-13 15:17:17 22831 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'  

  166. 2014-09-13 15:17:17 22831 [Note] Shutting down plugin 'MEMORY'  

  167. 2014-09-13 15:17:17 22831 [Note] Shutting down plugin 'MyISAM'  

  168. 2014-09-13 15:17:17 22831 [Note] Shutting down plugin 'CSV'  

  169. 2014-09-13 15:17:17 22831 [Note] Shutting down plugin 'MRG_MYISAM'  

  170. 2014-09-13 15:17:17 22831 [Note] Shutting down plugin 'sha256_password'  

  171. 2014-09-13 15:17:17 22831 [Note] Shutting down plugin 'mysql_old_password'  

  172. 2014-09-13 15:17:17 22831 [Note] Shutting down plugin 'mysql_native_password'  

  173. 2014-09-13 15:17:17 22831 [Note] Shutting down plugin 'binlog'  

  174. 2014-09-13 15:17:17 22831 [Note] /opt/mysql/bin/mysqld: Shutdown complete  

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  1. 第二种:mysqld_safe    

  2. 在安装目录的bin下面  

  3. 以下提示说明服务已经启动了  

  4. [root@mysql support-files]# /opt/mysql/bin/mysqld_safe &  

  5. [1] 22896  

  6. [root@mysql support-files]# 140913 15:19:32 mysqld_safe Logging to '/opt/mysql/data/mysql.err'.  

  7. 140913 15:19:32 mysqld_safe Starting mysqld daemon with databases from /opt/mysql/data    

  8. [root@mysql support-files]#   

  9. 140913 15:16:07 mysqld_safe mysqld from pid file /opt/mysql/data/mysql.pid ended  

  10. 140913 15:16:12 mysqld_safe Starting mysqld daemon with databases from /opt/mysql/data  

  11. 2014-09-13 15:16:12 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).  

  12. 2014-09-13 15:16:12 22831 [Note] Plugin 'FEDERATED' is disabled.  

  13. 2014-09-13 15:16:12 22831 [Note] InnoDB: Using atomics to ref count buffer pool pages  

  14. 2014-09-13 15:16:12 22831 [Note] InnoDB: The InnoDB memory heap is disabled  

  15. 2014-09-13 15:16:12 22831 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins  

  16. 2014-09-13 15:16:12 22831 [Note] InnoDB: Memory barrier is not used  

  17. 2014-09-13 15:16:12 22831 [Note] InnoDB: Compressed tables use zlib 1.2.3  

  18. 2014-09-13 15:16:12 22831 [Note] InnoDB: Not using CPU crc32 instructions  

  19. 2014-09-13 15:16:12 22831 [Note] InnoDB: Initializing buffer pool, size = 128.0M  

  20. 2014-09-13 15:16:12 22831 [Note] InnoDB: Completed initialization of buffer pool  

  21. 2014-09-13 15:16:12 22831 [Note] InnoDB: Highest supported file format is Barracuda.  

  22. 2014-09-13 15:16:12 22831 [Note] InnoDB: 128 rollback segment(s) are active.  

  23. 2014-09-13 15:16:12 22831 [Note] InnoDB: Waiting for purge to start  

  24. 2014-09-13 15:16:12 22831 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.20-68.0 started; log sequence number 1626047  

  25. 2014-09-13 15:16:12 22831 [Note] Server hostname (bind-address): '*'; port: 3306  

  26. 2014-09-13 15:16:12 22831 [Note] IPv6 is available.  

  27. 2014-09-13 15:16:12 22831 [Note]   - '::' resolves to '::';  

  28. 2014-09-13 15:16:12 22831 [Note] Server socket created on IP: '::'.  

  29. 2014-09-13 15:16:12 22831 [Note] Event Scheduler: Loaded 0 events  

  30. 2014-09-13 15:16:12 22831 [Note] /opt/mysql/bin/mysqld: ready for connections.  

  31. Version: '5.6.20-68.0'  socket: '/opt/mysql/run/mysqld.sock'  port: 3306  Source distribution

  32. mysqld_safe不能关闭数据库,使用以下命令可以关闭数据库    

  33. [root@mysql support-files]# service mysqld stop  

  34. Shutting down MySQL (Percona Server)..140913 15:21:03 mysqld_safe mysqld from pid file /opt/mysql/data/mysql.pid ended  

  35.  SUCCESS!   

  36. [1]+  Done                    /opt/mysql/bin/mysqld_safe  

  37. [root@mysql support-files]#

  38. 第三种方式:mysqld  

  39.   

  40. 这个和mysqld_safe命令是在  

  41.   

  42. [root@mysql bin]# mysqld --defaults-file=/etc/my.cnf --user=root                                                   

  43. 2014-09-13 15:24:32 23019 [Note] Plugin 'FEDERATED' is disabled.  

  44. 2014-09-13 15:24:32 23019 [Note] InnoDB: Using atomics to ref count buffer pool pages  

  45. 2014-09-13 15:24:32 23019 [Note] InnoDB: The InnoDB memory heap is disabled  

  46. 2014-09-13 15:24:32 23019 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins  

  47. 2014-09-13 15:24:32 23019 [Note] InnoDB: Memory barrier is not used  

  48. 2014-09-13 15:24:32 23019 [Note] InnoDB: Compressed tables use zlib 1.2.3  

  49. 2014-09-13 15:24:32 23019 [Note] InnoDB: Not using CPU crc32 instructions  

  50. 2014-09-13 15:24:32 23019 [Note] InnoDB: Initializing buffer pool, size = 128.0M  

  51. 2014-09-13 15:24:32 23019 [Note] InnoDB: Completed initialization of buffer pool  

  52. 2014-09-13 15:24:32 23019 [Note] InnoDB: Highest supported file format is Barracuda.  

  53. 2014-09-13 15:24:32 23019 [Note] InnoDB: 128 rollback segment(s) are active.  

  54. 2014-09-13 15:24:32 23019 [Note] InnoDB: Waiting for purge to start  

  55. 2014-09-13 15:24:32 23019 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.20-68.0 started; log sequence number 1626067  

  56. 2014-09-13 15:24:32 23019 [Note] Server hostname (bind-address): '*'; port: 3306  

  57. 2014-09-13 15:24:32 23019 [Note] IPv6 is available.  

  58. 2014-09-13 15:24:32 23019 [Note]   - '::' resolves to '::';  

  59. 2014-09-13 15:24:32 23019 [Note] Server socket created on IP: '::'.  

  60. 2014-09-13 15:24:32 23019 [Note] Event Scheduler: Loaded 0 events  

  61. 2014-09-13 15:24:32 23019 [Note] mysqld: ready for connections.  

  62. Version: '5.6.20-68.0'  socket: '/opt/mysql/run/mysqld.sock'  port: 3306  Source distribution  

  63.   

  64. mysql用户也是可以启动的  

  65.   

  66. [root@mysql ~]# /opt/mysql/bin/mysqld --defaults-file=/etc/my.cnf --user=mysql  

  67. 2014-09-13 15:29:30 23108 [Note] Plugin 'FEDERATED' is disabled.  

  68. 2014-09-13 15:29:30 23108 [Note] InnoDB: Using atomics to ref count buffer pool pages  

  69. 2014-09-13 15:29:30 23108 [Note] InnoDB: The InnoDB memory heap is disabled  

  70. 2014-09-13 15:29:30 23108 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins  

  71. 2014-09-13 15:29:30 23108 [Note] InnoDB: Memory barrier is not used  

  72. 2014-09-13 15:29:30 23108 [Note] InnoDB: Compressed tables use zlib 1.2.3  

  73. 2014-09-13 15:29:30 23108 [Note] InnoDB: Not using CPU crc32 instructions  

  74. 2014-09-13 15:29:30 23108 [Note] InnoDB: Initializing buffer pool, size = 128.0M  

  75. 2014-09-13 15:29:30 23108 [Note] InnoDB: Completed initialization of buffer pool  

  76. 2014-09-13 15:29:30 23108 [Note] InnoDB: Highest supported file format is Barracuda.  

  77. 2014-09-13 15:29:30 23108 [Note] InnoDB: 128 rollback segment(s) are active.  

  78. 2014-09-13 15:29:30 23108 [Note] InnoDB: Waiting for purge to start  

  79. 2014-09-13 15:29:30 23108 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.20-68.0 started; log sequence number 1626077  

  80. 2014-09-13 15:29:30 23108 [Note] Server hostname (bind-address): '*'; port: 3306  

  81. 2014-09-13 15:29:30 23108 [Note] IPv6 is available.  

  82. 2014-09-13 15:29:30 23108 [Note]   - '::' resolves to '::';  

  83. 2014-09-13 15:29:30 23108 [Note] Server socket created on IP: '::'.  

  84. 2014-09-13 15:29:30 23108 [Note] Event Scheduler: Loaded 0 events  

  85. 2014-09-13 15:29:30 23108 [Note] /opt/mysql/bin/mysqld: ready for connections.  

  86. Version: '5.6.20-68.0'  socket: '/opt/mysql/run/mysqld.sock'  port: 3306  Source distribution  

  87. 第四种:mysqld_multi    

  88. /opt/mysql/scripts/mysql_install_db --basedir=/opt/mysql --datadir=/opt/mysql/data --user=mysql  

  89. /opt/mysql/scripts/mysql_install_db --basedir=/opt/mysql --datadir=/opt/mysql/data3307 --user=mysql   

  90. 数据库初始化的正确状态:  

  91. [root@mysql mysql]# /opt/mysql/scripts/mysql_install_db --basedir=/opt/mysql --datadir=/opt/mysql/data --user=mysql  

  92. Installing MySQL system tables...OK    

  93. Filling help tables...OK    

  94. To start mysqld at boot time you have to copy  

  95. support-files/mysql.server to the right place for your system   

  96. PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !  

  97. To do so, start the server, then issue the following commands:    

  98.   /opt/mysql/bin/mysqladmin -u root password 'new-password'  

  99.   /opt/mysql/bin/mysqladmin -u root -h mysql password 'new-password'    

  100. Alternatively you can run:    

  101.   /opt/mysql/bin/mysql_secure_installation   

  102. which will also give you the option of removing the test  

  103. databases and anonymous user created by default.  This is  

  104. strongly recommended for production servers.    

  105. See the manual for more instructions.    

  106. You can start the MySQL daemon with:    

  107.   cd . ; /opt/mysql/bin/mysqld_safe &    

  108. You can test the MySQL daemon with mysql-test-run.pl    

  109.   cd mysql-test ; perl mysql-test-run.pl    

  110. Please report any problems at  

  111.  https://bugs.launchpad.net/percona-server/+filebug   

  112. The latest information about Percona Server is available on the web at  

  113.   http://www.percona.com/software/percona-server    

  114. Support Percona by buying support at  

  115.  http://www.percona.com/products/mysql-support    

  116. WARNING: Default config file /etc/my.cnf exists on the system  

  117. This file will be read by default by the MySQL server  

  118. If you do not want to use this, either remove it, or use the  

  119. --defaults-file argument to mysqld_safe when starting the server    

  120. [mysqld3306]  

  121. port            = 3306  

  122. socket          = /tmp/mysql3306.sock  

  123. pid-file    = /tmp/mysql3306.pid  

  124. basedir     = /usr/local/mysql  

  125. datadir     = /usr/local/mysql/data    

  126. [mysqld3307]  

  127. port            = 3307  

  128. socket          = /tmp/mysql3307.sock  

  129. pid-file    = /tmp/mysql3307.pid  

  130. basedir     = /usr/local/mysql  

  131. datadir     = /usr/local/mysql/data3307

  1. 多实例开启  

  2. [root@mysql bin]# mysqld_multi start 3307  

  3. [root@mysql bin]# mysqld_multi start 3306  

  4. [root@mysql bin]# mysqld_multi report  

  5. Reporting MySQL (Percona Server) servers  

  6. MySQL (Percona Server) from group: mysqld3306 is running  

  7. MySQL (Percona Server) from group: mysqld3307 is running

  1. 多实例关闭  

  2. [root@mysql bin]# mysqld_multi stop 3306   

  3. [root@mysql bin]# mysqld_multi stop 3307  

  4. [root@mysql bin]# mysqld_multi report  

  5. Reporting MySQL (Percona Server) servers  

  6. MySQL (Percona Server) from group: mysqld3306 is not running  

  7. MySQL (Percona Server) from group: mysqld3307 is not running  

  8. [root@mysql bin]#   

  1. root@mysql bin]# mysqld_multi start 3307  

  2. [root@mysql bin]# mysqld_multi start 3306  

  3. [root@mysql bin]#   

  4. [root@mysql bin]#   

  5. [root@mysql bin]# ps -ef|grep mysqld       

  6. root     26230     1  0 15:48 pts/2    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --port=3307 --socket=/tmp/mysql3307.sock --pid-file=/tmp/mysql3307.pid --skip-external-locking --key_buffer_size=16M --max_allowed_packet=1M --table_open_cache=64 --sort_buffer_size=512K --net_buffer_length=8K --read_buffer_size=256K --read_rnd_buffer_size=512K --myisam_sort_buffer_size=8M --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data3307  

  7. mysql    26506 26230  1 15:48 pts/2    00:00:00 /opt/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data3307 --plugin-dir=/usr/local/mysql/lib/mysql/plugin --user=mysql --skip-external-locking --key-buffer-size=16M --max-allowed-packet=1M --table-open-cache=64 --sort-buffer-size=512K --net-buffer-length=8K --read-buffer-size=256K --read-rnd-buffer-size=512K --myisam-sort-buffer-size=8M --log-error=/usr/local/mysql/data3307/mysql.err --pid-file=/tmp/mysql3307.pid --socket=/tmp/mysql3307.sock --port=3307  

  8. root     26535     1  0 15:48 pts/2    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --port=3306 --socket=/tmp/mysql3306.sock --pid-file=/tmp/mysql3306.pid --skip-external-locking --key_buffer_size=16M --max_allowed_packet=1M --table_open_cache=64 --sort_buffer_size=512K --net_buffer_length=8K --read_buffer_size=256K --read_rnd_buffer_size=512K --myisam_sort_buffer_size=8M --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data  

  9. mysql    26811 26535  3 15:48 pts/2    00:00:00 /opt/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/mysql/plugin --user=mysql --skip-external-locking --key-buffer-size=16M --max-allowed-packet=1M --table-open-cache=64 --sort-buffer-size=512K --net-buffer-length=8K --read-buffer-size=256K --read-rnd-buffer-size=512K --myisam-sort-buffer-size=8M --log-error=/usr/local/mysql/data/mysql.err --pid-file=/tmp/mysql3306.pid --socket=/tmp/mysql3306.sock --port=3306  

  10. root     26836 21316  0 15:48 pts/2    00:00:00 grep mysqld  

本文出自http://blog.csdn.net/minghuiguangdian/article/details/39252435