在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启动成功