在Mamp中,我的数据库启动了的,但是数据库始终连不上,不知道啥原因。
进入下面目录去看mysql的错误日志
cd /Applications/MAMP/logs
ls -al
-rw-r--r--@ 1 yshuq admin 2323 Oct 27 20:37 MAMP_PRO_Save.log
-rw-r--r-- 1 yshuq admin 448358 Oct 29 11:23 apache_error.log
-rw-r--r-- 1 root admin 81924 Aug 10 15:29 apache_ssl_access.log
-rw-r--r-- 1 root admin 13549 Apr 25 2022 apache_ssl_error.log
-rw-r--r-- 1 root admin 103260 Aug 10 15:29 apache_ssl_request.log
-rw-r--r-- 1 yshuq admin 0 Oct 29 10:44 cloud.log
-rw-r--r-- 1 yshuq admin 0 May 30 13:16 cloud_mamp.log
-rw-r----- 1 yshuq admin 250443175 Oct 29 11:23 mysql_error.log
-rw-r--r--@ 1 yshuq admin 0 May 30 13:23 mysql_error_log.err
-rw-r--r-- 1 yshuq admin 4029459 Oct 6 17:46 php_error.log
-rw-rw-r-- 1 yshuq admin 28025 Oct 29 11:23 redis_error.log
-rw-r--r--@ 1 yshuq admin 868 Aug 30 2021 setup.log
yshuqdeMacBook-Pro:logs yshuq$ cat mysql_error.log
[Warning] InnoDB: Table mysql/innodb_table_stats has length mismatch in the column name table_name. Please run mysql_upgrade
解决办法:
使用下面命令进入到下面文件:
cd /Applications/MAMP/Library/bin/
输入命令:
./mysql_upgrade -uroot -p
输入密码之后将出现许多类似下面代码。
......
opencart3033.oc_stock_status OK
opencart3033.oc_store OK
opencart3033.oc_tax_class OK
opencart3033.oc_tax_rate OK
opencart3033.oc_tax_rate_to_customer_group OK
opencart3033.oc_tax_rule OK
opencart3033.oc_theme OK
opencart3033.oc_translation OK
opencart3033.oc_upload OK
......
......
Upgrade process completed successfully.
Checking if update is needed.
You have new mail in /var/mail/yshuq
......
......
......
Upgrade process completed successfully.
Checking if update is needed.
You have new mail in /var/mail/yshuq
参考: