MySQL 不允许我添加列
这应该是一个非常简单的过程,但无论出于何种原因,我无法向 MySQL 表添加列。这是我的语法:
$query = "ALTER TABLE game_licenses ADD lifetime VARCHAR(255) AFTER expire_date";
$result = mysql_query($query);
if (!$result) {
echo "it failed";
}
else {
echo "success";
}
我尝试了多个小更改,例如在 ADD 之后将 COLUMN 添加到查询中。没有 MySQL 错误,但完成了脚本并回显“失败”。
错误是:
ALTER 命令拒绝用户“webuser”@“localhost”
是否可以锁定表以防止被更改?
This should be a really simple process but for whatever reason, I am unable to add a column to an MySQL table. Here's my syntax:
$query = "ALTER TABLE game_licenses ADD lifetime VARCHAR(255) AFTER expire_date";
$result = mysql_query($query);
if (!$result) {
echo "it failed";
}
else {
echo "success";
}
I've tried multiple little changes like adding COLUMN to the query after ADD. There are no MySQL errors but finishes the script and echos "it failed".
The error is:
ALTER command denied to user 'webuser'@'localhost'
Is it possible to lock a table from being altered?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您没有权限这样做。
确保您对该表具有
alter
权限。让超级用户(root)执行以下命令:
请参阅:http://dev .mysql.com/doc/refman/5.1/en/grant.html。
PS 您确定希望普通用户能够发出
alter
语句吗?更好的选择可能是以 root 身份发出 alter 语句,或者更好的是创建一个对数据库拥有完全权限的管理员帐户,但对任何其他数据库没有完全权限。
You don't have the privileges to do so.
Make sure you have the
alter
privilege on that table.Have the superuser (root) execute the following:
See: http://dev.mysql.com/doc/refman/5.1/en/grant.html.
P.S. Are you sure you want normal users to be able to issue
alter
statements?Better option may be to issue the alter statement as root, or even better to make an admin account that has full rights on the database, but not full rights on any other database.