douwen5833 2011-08-21 02:48
浏览 102
已采纳

无法在服务器上使用PHP创建MySQL数据库?

I keep getting this error, and I'm not really sure why this isn't working here.

I'm trying to create a database with PHP and it's returning the following error:

Error creating database: Access denied for user 'scriptcooke'@'10.%' to database 'my_db'

I believe I have the correct credentials, but what does @10.% even mean?

NOTE: I'm trying to use the w3schools code example here:

<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

if (mysql_query("CREATE DATABASE my_db",$con))
  {
  echo "Database created";
  }
else
  {
  echo "Error creating database: " . mysql_error();
  }

mysql_close($con);
?>
  • 写回答

5条回答 默认 最新

  • dqrdlqpo775594 2011-08-21 02:51
    关注

    @10.% is the field for the source host in the user definition.

    The problem is: You don't have the permissions to create a new database. The user you are using may only use his own database;

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站