警告:mysqli_connect(): (HY000/1049): 仅在 mac 终端中的未知数据库 [英] Warning: mysqli_connect(): (HY000/1049): Unknown database in mac terminal only

查看:93
本文介绍了警告:mysqli_connect(): (HY000/1049): 仅在 mac 终端中的未知数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 mac 中我想创建 cronjob,但是当我使用数据库运行 php 文件时,我在终端中遇到错误.

in mac i want to create cronjob but when i run the php file with database i am getting error in terminal.

Warning: mysqli_connect(): (HY000/1049): Unknown database 

并且在浏览器中运行完美.

And In the browser run perfect.

推荐答案

你的PHP环境和你的浏览器PHP一样吗?例如,命令行 php.ini 可能与您的 XAMP 或其他已安装的网络服务器不同

Is your PHP environment the same as your browsers PHP? command line php.ini can differ from, for example, your XAMP or other installed webserver

我建议先检查一下

对我来说,这成功了

编辑您的 .bash_profile 文件,如

export PATH=/Applications/MAMP/bin/php/php7.1.1/bin:$PATH

从 XAMP 编辑 PHP bin 的路径

edit the path to your PHP bin from your XAMP

这篇关于警告:mysqli_connect(): (HY000/1049): 仅在 mac 终端中的未知数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆