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条)

报告相同问题?

悬赏问题

  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动