[英]Trying to import sql-script into existing database generates error
I have following sql-script: 我有以下sql脚本:
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
-- -----------------------------------------------------
-- Table `Soccerproject`.`user`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `Soccerproject`.`user` (
`userName` VARCHAR(45) NULL,
`email` VARCHAR(60) NOT NULL,
`password` VARCHAR(150) NOT NULL,
`money` BIGINT NOT NULL,
`userid` INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`userid`),
UNIQUE INDEX `userid_UNIQUE` (`userid` ASC),
UNIQUE INDEX `userName_UNIQUE` (`userName` ASC),
UNIQUE INDEX `email_UNIQUE` (`email` ASC))
ENGINE = InnoDB;
However I get this error when I try to import it: 但是,当我尝试导入它时出现此错误:
#1142 - CREATE command denied to user '*****'@'localhost' for table 'user'
Googeling did not resolve my issue ... Googeling无法解决我的问题...
Your user does not have privileges to create tables in that database. 您的用户无权在该数据库中创建表。 The MySQL docs show you the syntax for granting permissions to a user, so give that a try.
MySQL文档向您显示了授予用户权限的语法,因此请尝试一下。
you can do something like this: 您可以执行以下操作:
GRANT CREATE ON <dbname> TO 'Stijnxk59'@'<dbhost>';
this will give the user CREATE privileges, but you can add ALTER privileges and any others you want. 这将为用户提供CREATE特权,但是您可以添加ALTER特权和您想要的任何其他特权。 Or you can even grant ALL privileges, it just depends what you want to allow that user to do.
或者甚至可以授予ALL特权,这仅取决于您要允许该用户执行的操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.