Solve the problem that mysql cannot start

(1)

➜ sudo mysql.server start

Starting MySQL

. ERROR! The server quit without updating PID file (/usr/local/var/mysql/yuandeMacBook-Pro.local.pid).

 

 

 

Last login: Sat Oct 10 23:07:52 on ttys000

➜  sudo krbservicesetup 

➜ sudo mysql.server start

Starting MySQL

. ERROR! The server quit without updating PID file (/usr/local/var/mysql/yuandeMacBook-Pro.local.pid).

➜ sudo chown  -R _mysql:mysql  /usr/local/var/mysql  

➜  ~  

 

 

(2) add  my.cnf   

 

By default, mysql installed by brew will not generate a my.cnf file. You need to assign the my-default.cnf file in the /usr/local/Cellar/mysql/5.6.27/support-files file to /etc/ and rename it to my.cnf. In this way, you can modify the mysql configuration by modifying my.cnf in the future.

 

 

(3):

MySQL connection not working: 2002 No such file or directory

Required: add php.ini 

 

  3.1 Open some required extensions

 

  3.2 Setting pdo_mysql.default_socket

mysql.default_socket = /tmp/mysqld.sock

pdo_mysql.default_socket= /tmp/mysqld.sock

mysqli.default_socket =/tmp/mysqld.sock

 

(4) The mac opens the slow log, error log and normal log of mysql.

The configuration method is as follows, add the following in /etc/my.cnf: 

general_log = 1

general_log_file = /var/log/mysql/mysql.log

 

#

# Error log - should be very few entries.

#

log_error = /var/log/mysql/error.log

#

# Here you can see queries with especially long duration

slow-query-log        = /var/log/mysql/mysql-slow.log

long_query_time = 2

#log-queries-not-using-indexes

 

 

Note: The things to note here are: 

Before mysql5.11 , the open variable of slow log was: log_slow_queries

 

And now it's show-query-log

 

 

 

 

5: An error is reported when brew install php56 :  

   Error: Formulae found in multiple taps: 

 * homebrew/php/php56

 * josegonzalez/php/php56

 

Please use the fully-qualified name e.g. homebrew/php/php56 to refer the formula.

 

 

Solution: 

 

 brew untap josegonzalez/php

 brew tap --repair

 brew update

 

that's it.

 

 

Reference link:

1: http://stackoverflow.com/questions/1676688/php-mysql-connection-not-working-2002-no-such-file-or-directory

 

2:  http://stackoverflow.com/questions/20723803/pdoexception-sqlstatehy000-2002-no-such-file-or-directory

 

 

 

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326612492&siteId=291194637