简体   繁体   中英

Can't connect to local MySQL Server with homebrew

I have installed the MySQL-Server with homebrew before on another User on my Macbook Pro, but I must change the User and now I can't start the MySQL server:

$ mysql.server start
Starting MySQL
./usr/local/Cellar/mysql/5.7.22/bin/mysqld_safe: line 144: 
/usr/local/var/mysql/Stefans-MacBook-Pro.local.err: Permission denied
/usr/local/Cellar/mysql/5.7.22/bin/mysqld_safe: line 144: 
/usr/local/var/mysql/Stefans-MacBook-Pro.local.err: Permission denied
/usr/local/Cellar/mysql/5.7.22/bin/mysqld_safe: line 198: 
/usr/local/var/mysql/Stefans-MacBook-Pro.local.err: Permission denied
/usr/local/Cellar/mysql/5.7.22/bin/mysqld_safe: line 144: 
/usr/local/var/mysql/Stefans-MacBook-Pro.local.err: Permission denied
ERROR! The server quit without updating PID file 
(/usr/local/var/mysql/Stefans-MacBook-Pro.local.pid).

The User "Stefan" doesn't exist anymore. Maybe the rights on /usr/local/var/mysql are not correct, but I am unsure about what I can do to fix it.

The rights are:

$ sudo ls -lah /usr/local/var/mysql/
Password:
total 221392
drwxr-xr-x   20 501  admin   640B 25 Apr 15:47 .
drwxrwxr-x    8 501  admin   256B 20 Apr 10:12 ..
-rw-r-----    1 501  admin    60K 25 Apr 15:47 Stefans-MacBook-Pro.local.err
-rw-r-----    1 501  admin    56B 20 Apr 10:12 auto.cnf
-rw-------    1 501  admin   1,6K 20 Apr 10:12 ca-key.pem
-rw-r--r--    1 501  admin   1,1K 20 Apr 10:12 ca.pem
-rw-r--r--    1 501  admin   1,1K 20 Apr 10:12 client-cert.pem
-rw-------    1 501  admin   1,6K 20 Apr 10:12 client-key.pem
-rw-r-----    1 501  admin   464B 25 Apr 15:47 ib_buffer_pool
-rw-r-----    1 501  admin    48M 25 Apr 15:47 ib_logfile0
-rw-r-----    1 501  admin    48M 20 Apr 10:12 ib_logfile1
-rw-r-----    1 501  admin    12M 25 Apr 15:47 ibdata1
drwxr-x---   77 501  admin   2,4K 20 Apr 10:12 mysql
drwxr-x---   90 501  admin   2,8K 20 Apr 10:12 performance_schema
-rw-------    1 501  admin   1,6K 20 Apr 10:12 private_key.pem
-rw-r--r--    1 501  admin   452B 20 Apr 10:12 public_key.pem
-rw-r--r--    1 501  admin   1,1K 20 Apr 10:12 server-cert.pem
-rw-------    1 501  admin   1,6K 20 Apr 10:12 server-key.pem
drwxr-x---  108 501  admin   3,4K 20 Apr 10:12 sys
drwxr-x---   25 501  admin   800B 20 Apr 12:00 textspinner

I have also tried to reinstall MySQL server but it doesn't work.

How can I fix this?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM