初始化MySQL服務後,使用/etc/init.d/mysqld啓動MySQL服務,報錯,查看其錯誤日誌error.log:mysql
150413 21:26:54 mysqld_safe mysqld from pid file /data/mysqldata/mysql.pid ended 150413 21:30:19 mysqld_safe Starting mysqld daemon with databases from /data/mysqldata 2015-04-13 21:30:21 27464 [Note] Plugin 'FEDERATED' is disabled. 2015-04-13 21:30:21 27464 [Note] InnoDB: Using atomics to ref count buffer pool pages 2015-04-13 21:30:21 27464 [Note] InnoDB: The InnoDB memory heap is disabled 2015-04-13 21:30:21 27464 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2015-04-13 21:30:21 27464 [Note] InnoDB: Compressed tables use zlib 1.2.3 2015-04-13 21:30:21 27464 [Note] InnoDB: Using Linux native AIO 2015-04-13 21:30:21 27464 [Note] InnoDB: Using CPU crc32 instructions 2015-04-13 21:30:21 27464 [Note] InnoDB: Initializing buffer pool, size = 24.0G 2015-04-13 21:30:23 27464 [Note] InnoDB: Completed initialization of buffer pool 2015-04-13 21:30:24 27464 [Note] InnoDB: Highest supported file format is Barracuda. 2015-04-13 21:30:25 27464 [Note] InnoDB: 128 rollback segment(s) are active. 2015-04-13 21:30:25 27464 [Note] InnoDB: Waiting for purge to start 2015-04-13 21:30:25 27464 [Note] InnoDB: 5.6.19 started; log sequence number 1626134 2015-04-13 21:30:25 27464 [Note] Server hostname (bind-address): '*'; port: 3306 2015-04-13 21:30:25 27464 [Note] IPv6 is available. 2015-04-13 21:30:25 27464 [Note] - '::' resolves to '::'; 2015-04-13 21:30:25 27464 [Note] Server socket created on IP: '::'. 2015-04-13 21:30:25 27464 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use 2015-04-13 21:30:25 27464 [ERROR] Do you already have another mysqld server running on port: 3306 ? 2015-04-13 21:30:25 27464 [ERROR] Aborting
經過其報錯信息,咱們能夠明顯的看到3306端口已經被佔用sql
緣由:初始化MySQL的使用沒有中止MySQL服務 netstat -nputl|grep 3306 結果發現已經有一個MySQL服務在啓動 150413 21:30:29 mysqld_safe mysqld from pid file /data/mysqldata/mysql.pid ended 經過/etc/init.d/mysqld stop將MySQL服務中止,若是不行,則使用kill -9 pid將其殺死 再次啓動MySQL服務:/etc/init.d/mysqld start [root@localhost ~]# /etc/init.d/mysqld start Starting MySQL........ SUCCESS!
切記:初始化MySQL時,必定要先中止數據庫服務數據庫
service mysqld stop bash