执行会报错
php think migrate:run
[InvalidArgumentException]
There was a problem connecting to the database: SQLSTATE[HY000] [2002] Connection refused
找到了这个帖子http://www.thinkphp.cn/topic/56453.html
但是最好不要改ThinkPHP核心框架这个问题的原因是Mac默认自带PHP,将你自己的PHP版本添加进环境变量即可
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
export PATH="/Applications/MAMP/bin/php/php7.1.20/bin:$PATH"
PS:首行默认是source ~/.profile 需改成上方第一行代码,否则会报-bash: /Users/xxx/.profile: No such file or directory添加完毕然后执行
source .bash_profile
php think migrate:run
就没有问题了,如果还报错,请将数据库配置文件改为localhost 最佳答案
