前几天一直在弄这个。本来根据官网的教程一步一步下来之后ubuntu 12.04下源代码安装mysql是可以的,但是在安装了python-mysqldb之后发现mysql就不行了,已启动就会出现“the mysql server quit without updating the pid file(/usr/local/bin/mysql/data/xxxxx.pid”错误或者出现”mysql server cannot be found(/usr/bin/mysqld_safe)“错误。
相关阅读:
ubuntu 12.04下安装mysql图解 http://www.linuxidc.com/linux/2013-01/78716p3.htm
linux源码安装mysql 5.6.12 (cmake编译) http://www.linuxidc.com/linux/2013-07/87640.htm
基于cmake编译安装mysql 5.5 http://www.linuxidc.com/linux/2013-04/83579.htm
ubuntu 通过deb 安装 mysql 5.5 http://www.linuxidc.com/linux/2013-07/87372.htm
后来发现是一个/etc/mysql/my.cnf这个文件导致的,这个文件是安装了python-mysqldb之后才会出现的,除非你安装mysql是把my-default.cnf拷贝到这个位置了。安装好后python-mysqldb之后的/etc/mysql/my.cnf文件的内容应该如下:
## the mysql database server configuration file.## you can copy this to one of:# – “/etc/mysql/my.cnf” to set global options,# – “~/.my.cnf” to set user-specific options.## one can use all long options that the program supports.# run program with –help to get a list of available options and with# –print-defaults to see which it would actually understand and use.## for explanations see# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
# this will be passed to all mysql clients# it has been reported that passwords should be enclosed with ticks/quotes# escpecially if they contain “#” chars…# remember to edit /etc/mysql/debian.cnf when changing the socket location.[client]port = 3306socket = /var/run/mysqld/mysqld.sock
# here is entries for some specific programs# the following values assume you have at least 32m ram
# this was formally known as [safe_mysqld]. both versions are currently parsed.[mysqld_safe]socket = /var/run/mysqld/mysqld.socknice = 0
[mysqld]## * basic settings#user = mysqlpid-file = /var/run/mysqld/mysqld.pidsocket = /var/run/mysqld/mysqld.sockport = 3306basedir = /usrdatadir = /var/lib/mysqltmpdir = /tmplc-messages-dir = /usr/share/mysqlskip-external-locking## instead of skip-networking the default is now to listen only on# localhost which is more compatible and is not less secure.bind-address = 127.0.0.1## * fine tuning#key_buffer = 16mmax_allowed_packet = 16mthread_stack = 192kthread_cache_size = 8# this replaces the startup script and checks myisam tables if needed# the first time they are touchedmyisam-recover = backup#max_connections = 100#table_cache = 64#thread_concurrency = 10## * query cache configuration#query_cache_limit = 1mquery_cache_size = 16m## * logging and replication## both location gets rotated by the cronjob.# be aware that this log type is a performance killer.# as of 5.1 you can enable the log at runtime!#general_log_file = /var/log/mysql/mysql.log#general_log = 1## error log – should be very few entries.#log_error = /var/log/mysql/error.log## here you can see queries with especially long duration#log_slow_queries = /var/log/mysql/mysql-slow.log#long_query_time = 2#log-queries-not-using-indexes## the following can be used as easy to replay backup logs or for replication.# note: if you are setting up a replication slave, see readme.debian about# other settings you may need to change.#server-id = 1#log_bin = /var/log/mysql/mysql-bin.logexpire_logs_days = 10max_binlog_size = 100m#binlog_do_db = include_database_name#binlog_ignore_db = include_database_name## * innodb## innodb is enabled by default with a 10mb datafile in /var/lib/mysql/.# read the manual for more innodb related options. there are many!## * security features## read the manual, too, if you want chroot!# chroot = /var/lib/mysql/## for generating ssl certificates i recommend the openssl gui “tinyca”.## ssl-ca=/etc/mysql/cacert.pem# ssl-cert=/etc/mysql/server-cert.pem# ssl-key=/etc/mysql/server-key.pem
[mysqldump]quickquote-namesmax_allowed_packet = 16m
[mysql]#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]key_buffer = 16m
## * important: additional settings that can override those from this file!# the files must end with ‘.cnf’, otherwise they’ll be ignored.#!includedir /etc/mysql/conf.d/
至于如何修改以上文件从而让mysql正常启动?接下来从我安装mysql和python-mysqldb的过程说起。当然如果你选择了使用apt-get install python-mysqldb mysql-server是不会出现上述错误的。
接下来请看第2页的精彩内容:http://www.linuxidc.com/linux/2013-08/89270p2.htm