mysql用户访问数据库被拒绝,用户访问数据库被拒绝

I have built an SQL query and sent it to the MySQL Server using a PHP program/script. Everything was working fine and the connection was good until I attempted to CREATE DATABASE. Then I got this error:

Error: Access denied for user ''''@''localhost'' to database ''petcatalog''

Does anyone know why I am not connecting and how I fix this?

Thanks

P.S.

I know I can use the command prompt to build a database but I would like to complete this project of building a database using php scripts to connect with mysql server.

解决方案What is the full error message? It''ll include something like ''USING PASSWORD yes''.

it also looks like there’s no login name passed.

Note that you need to have the CREATE privilege for the database before you create it. Meaning that, before you create the database, a user with the GRANT privilege (like root) needs to issue a GRANT command, giving the user you are using in your scripts permission to create the database.

Because of this, you are generally just better of creating the database using the admin user. You are going to have to use it to grant the privileges anyways.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值