在windows服務器上安裝了Cygwin,然後用Cygwin安裝完MySQL,此過程略,百度即可
cd /usr/local/mysql (此路徑爲MySQL安裝路徑,根據個人安裝情況而定)
$ cp support-files/mysql.server /etc/inetd.d/mysqld
$ /etc/inetd.d/mysqld start
Starting MySQL............ ERROR! The server quit without updating PID file (/usr/local/mysql/data/Test.pid).
啓動服務的時候出錯,在網上找解決辦法,方法各種各樣,有可能是因爲導致這種錯誤的原因很多吧,但是我這裏查看了一下日誌文件,日誌路徑是
/usr/local/mysql/data/Test.err
內容大致如下:
$ cat Test.err
150508 15:11:22 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
2015-05-08 15:11:22 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use -- explicit_defaults_for_timestamp server option (see documentation for more details).
2015-05-08 15:11:22 2316 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2015-05-08 15:11:22 2316 [Warning] One can only use the --user switch if running as root
2015-05-08 15:11:22 2316 [Warning] Buffered warning: Changed limits: max_open_files: 256 (requested 5000)
2015-05-08 15:11:22 2316 [Warning] Buffered warning: Changed limits: table_cache: 400 (requested 2000)
2015-05-08 15:11:22 2316 [Note] Plugin 'FEDERATED' is disabled.
2015-05-08 15:11:22 2316 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-05-08 15:11:22 2316 [Note] InnoDB: The InnoDB memory heap is disabled
2015-05-08 15:11:22 2316 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-05-08 15:11:22 2316 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-05-08 15:11:22 2316 [Note] InnoDB: Using CPU crc32 instructions
2015-05-08 15:11:22 2316 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-05-08 15:11:23 2316 [Note] InnoDB: Completed initialization of buffer pool
2015-05-08 15:11:23 2316 [Note] InnoDB: Highest supported file format is Barracuda.
2015-05-08 15:11:23 2316 [Note] InnoDB: 128 rollback segment(s) are active.
2015-05-08 15:11:23 2316 [Note] InnoDB: Waiting for purge to start
2015-05-08 15:11:23 2316 [Note] InnoDB: 5.6.16 started; log sequence number 1626017
2015-05-08 15:11:23 2316 [Note] Server hostname (bind-address): '*'; port: 3306
2015-05-08 15:11:23 2316 [Note] IPv6 is available.
2015-05-08 15:11:23 2316 [Note] - '::' resolves to '::';
2015-05-08 15:11:23 2316 [Note] Server socket created on IP: '::'.
2015-05-08 15:11:23 2316 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
2015-05-08 15:11:23 2316 [ERROR] Do you already have another mysqld server running on port: 3306 ?
2015-05-08 15:11:23 2316 [ERROR] Aborting
2015-05-08 15:11:23 2316 [Note] Binlog end
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'partition'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_METRICS'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_CMPMEM'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_CMP'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_LOCKS'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'INNODB_TRX'
2015-05-08 15:11:23 2316 [Note] Shutting down plugin 'InnoDB'
2015-05-08 15:11:23 2316 [Note] InnoDB: FTS optimize thread exiting.
2015-05-08 15:11:23 2316 [Note] InnoDB: Starting shutdown...
2015-05-08 15:11:33 2316 [Note] InnoDB: Shutdown completed; log sequence number 1626027
2015-05-08 15:11:33 2316 [Note] Shutting down plugin 'BLACKHOLE'
2015-05-08 15:11:33 2316 [Note] Shutting down plugin 'ARCHIVE'
2015-05-08 15:11:33 2316 [Note] Shutting down plugin 'MRG_MYISAM'
2015-05-08 15:11:33 2316 [Note] Shutting down plugin 'MyISAM'
2015-05-08 15:11:33 2316 [Note] Shutting down plugin 'MEMORY'
2015-05-08 15:11:33 2316 [Note] Shutting down plugin 'CSV'
2015-05-08 15:11:33 2316 [Note] Shutting down plugin 'sha256_password'
2015-05-08 15:11:33 2316 [Note] Shutting down plugin 'mysql_old_password'
2015-05-08 15:11:33 2316 [Note] Shutting down plugin 'mysql_native_password'
2015-05-08 15:11:33 2316 [Note] Shutting down plugin 'binlog'
2015-05-08 15:11:33 2316 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
150508 15:11:33 mysqld_safe mysqld from pid file /usr/local/mysql/data/IPC-Test.pid ended
原因:
從上面的日誌可以看到是端口占用的問題,記起之前在windows服務器上安裝過windows版本的MySQL並一直以服務的方式啓動着,在windows的服務下停止windows版本的MySQL即可,再執行
$ /etc/inetd.d/mysqld start
Starting MySQL.. SUCCESS!
現在MySQL啓動成功