简体   繁体   中英

PHPMyAdmin not letting me import .sql file

I'm trying to import the following .sql file, containing:

CREATE TABLE IF NOT EXISTS  `login`.`users` (
 `user_id` INT( 11 ) NOT NULL AUTO_INCREMENT COMMENT  'auto incrementing user_id of each user, unique index',
 `user_name` VARCHAR( 64 ) COLLATE utf8_unicode_ci NOT NULL COMMENT  'user''s name, unique',
 `user_password_hash` VARCHAR( 255 ) COLLATE utf8_unicode_ci NOT NULL COMMENT  'user''s password in salted and hashed format',
 `user_email` VARCHAR( 64 ) COLLATE utf8_unicode_ci NOT NULL COMMENT  'user''s email, unique',
PRIMARY KEY (  `user_id` ) ,
UNIQUE KEY  `user_name` (  `user_name` ) ,
UNIQUE KEY  `user_email` (  `user_email` )
) ENGINE = INNODB DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci COMMENT =  'user data';

but it gives me the error

#1142 - CREATE command denied to user ''@'localhost' for table 'users'

What's the problem here and how can I solve this?

This might be helpful.

Go to phpMyAdmin -> users , select the user you want to change and give all the privileges.

As some of the others have said, you appear to lack privileges to create a table in the login database. Given the error message which references the user ''@'localhost', this is almost certainly because you're not logged in as your actual user, but instead are the anonymous user. Check your username and password against what the host provided, try logging in via the command-line client if available, and be aware of your host and connection type.

You're connecting via sockets, which means your user account has to have the host 'localhost'. If your user only has the host '%' then you'll have to either ask your host for the 'localhost' privilege or configure phpMyAdmin to connect via TCP/IP due to how MySQL handles incoming connections and the wildcard privilege.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM