我面临着大多数人在启动MYSQL时遇到的相同问题。我在Stack Overflow和其他论坛上阅读了很多主题,但没有任何帮助。
我在寻找一些帮助,请。
以下是我尝试的步骤-
Shrek-MacBook-Pro:~ Shrek_User$ brew services start mariadb
==> Successfully started `mariadb` (label: homebrew.mxcl.mariadb)
Shrek-MacBook-Pro:~ Shrek_User$ brew services list
Name Status User Plist
grafana stopped
httpd stopped
mariadb started Shrek_User /Users/Shrek_User/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
php@5.6 stopped
prometheus stopped
Shrek-MacBook-Pro:~ Shrek_User$ which mysql
/usr/local/bin/mysql
Shrek-MacBook-Pro:~ Shrek_User$ mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Shrek-MacBook-Pro:~ Shrek_User$
Shrek-MacBook-Pro:~ Shrek_User$ mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Shrek-MacBook-Pro:~ Shrek_User$ mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Shrek-MacBook-Pro:~ Shrek_User$
尝试以相同模式停止和启动。
Shrek-MacBook-Pro:~ Shrek_User$ brew services stop mariadb
Stopping `mariadb`... (might take a while)
==> Successfully stopped `mariadb` (label: homebrew.mxcl.mariadb)
Shrek-MacBook-Pro:~ Shrek_User$
Shrek-MacBook-Pro:~ Shrek_User$
Shrek-MacBook-Pro:~ Shrek_User$ sudo mysqld_safe --skip-grant-tables --skip-networking
Password:
190201 22:24:49 mysqld_safe Logging to '/usr/local/var/Shrek-MacBook-Pro.local.err'.
190201 22:24:49 mysqld_safe Starting mysqld daemon with databases from /usr/local/var
Shrek-MacBook-Pro:~ Shrek_User$
但是,当在 '/usr/local/var/Shrek-MacBook-Pro.local.err' 日志文件看去,它打印:
Shrek-MacBook-Pro:~ Shrek_User$ cat /usr/local/var/Shrek-MacBook-Pro.local.err
.
.
.
.
2019-02-01 21:16:16 0 [Note] InnoDB: Setting log file ./ib_logfile1 size to 50331648 bytes
2019-02-01 21:16:16 0 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2019-02-01 21:16:16 0 [Note] InnoDB: New log files created, LSN=45786
2019-02-01 21:16:16 0 [Note] InnoDB: Doublewrite buffer not found: creating new
2019-02-01 21:16:16 0 [Note] InnoDB: Doublewrite buffer created
2019-02-01 21:16:16 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2019-02-01 21:16:16 0 [Note] InnoDB: Creating foreign key constraint system tables.
2019-02-01 21:16:16 0 [Note] InnoDB: Creating tablespace and datafile system tables.
2019-02-01 21:16:16 0 [Note] InnoDB: Creating sys_virtual system tables.
2019-02-01 21:16:16 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-02-01 21:16:16 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2019-02-01 21:16:16 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2019-02-01 21:16:16 0 [Note] InnoDB: Waiting for purge to start
2019-02-01 21:16:17 0 [Note] InnoDB: 10.3.12 started; log sequence number 0; transaction id 7
2019-02-01 21:16:17 0 [Note] Plugin 'FEEDBACK' is disabled.
2019-02-01 21:16:17 0 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
2019-02-01 21:16:17 0 [Note] Server socket created on IP: '::'.
2019-02-01 21:16:17 0 [ERROR] Can't start server: Bind on TCP/IP port. Got error: 48: Address already in use
2019-02-01 21:16:17 0 [ERROR] Do you already have another mysqld server running on port: 3306 ?
2019-02-01 21:16:17 0 [ERROR] Aborting
Shrek-MacBook-Pro:~ Shrek_User$
当通过另一壳/终端窗口试图登录,看起来像服务器进程没有启动。
Shrek-MacBook-Pro:~ Shrek_User$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Shrek-MacBook-Pro:~ Shrek_User$
如何解决此问题?任何帮助表示赞赏。
答案 0 :(得分:0)
我尝试了以下方法,并且有效。
brew remove mariadb
brew cleanup
brew services list
sudo rm -rf /usr/local/var/mysql
brew install mariadb
mysql --version
mysql Ver 15.1 Distrib 10.3.12-MariaDB, for osx10.14 (x86_64) using readline 5.1
brew services start mariadb
我能够启动MariaDB服务器-
Shrek-MacBook-Pro:~ Shrek_User $ mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 10.3.12-MariaDB Homebrew
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>