简体   繁体   English

尝试将sql脚本导入现有数据库会产生错误

[英]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.

相关问题 为什么不执行sql-script? - Why sql-script isn't executed? SQL 脚本不会在 Joomla 中的组件安装中插入值 - SQL-script does not insert values in component installation in Joomla Flywheel本地-尝试导入现有站点和数据库以进行脱机开发。 收到错误:“建立数据库连接时出错” - Local by Flywheel - Trying to import an existing site and database for offline development. Getting error: “Error establishing a database connection” 尝试将 SQL 数据库导入 Google Cloud Platform 时出错 - Error when trying to import SQL database to Google Cloud Platform MYSQL Workbench 尝试在新数据库中导入现有表的转储文件夹时出错 - Error on MYSQL Workbench trying to import a dump folder of existing tables in a new database 有人知道可以立即使用sql-script的MySQL全面的伪造数据生成器吗? - Does anybody know comprehensive fake data generator for MySQL that can be used right away from sql-script? 试图使用SQL命令导入数据库? - trying to import database using sql command? 尝试导入sql fle,但面临此错误 - trying to import sql fle , but facing this error 在AWS RDS上托管的数据库上导入SQL脚本期间,MySql错误&#39;max_allowed_pa​​cket&#39;字节 - MySql Error 'max_allowed_packet' bytes during import SQL script on database hosted on AWS RDS MySQL导入到现有数据库 - MySQL import to existing database
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM