phpmyadmin cant import .sql

Connect with other users about what to run on your webhosting (and how to run it) here.
Post Reply
12114
A semi-regular
A semi-regular
Posts: 20
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Wed Dec 19, 2012 6:19 pm

phpmyadmin cant import .sql

Post by 12114 »

trying to import .sql file to my database from my pc, but it gives me this error:
SQL query: Documentation

GRANT SELECT ON `**_superhero` . *
TO ub@localhost
IDENTIFIED BY '*******';

MySQL said: Documentation
#1044 - Access denied for user '**'@'localhost' to database '**_superhero'

TO ub@localhost has an exclamation mark in front of it..

i've tried changing the password..

i put stars on purpose instead of my password and host name.
User avatar
Edge100x
Founder
Founder
Posts: 13113
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: phpmyadmin cant import .sql

Post by Edge100x »

GRANT lines require superuser privileges and this means you can't use them; you'll have to remove those lines from your file. Additionally, you will need to remove any CREATE DATABASE statements, and you'll need to adjust commands to reference your new database on the webhosting here.
12114
A semi-regular
A semi-regular
Posts: 20
Joined: Wed Dec 19, 2012 6:19 pm

Re: phpmyadmin cant import .sql

Post by 12114 »

Tnaks for reply, but i'm new to sql and i'm not sure what exactly to comment out. here's the original file:

Code: Select all

# Created by...: Kevin tkm@gamersource.net
# Description..: SuperHeroMod MySQL Install Script
# Orig Date....: 08/01/03
# Modified Date: 08/11/08
#
# Reference:  Linux: See MySQL_README_LINUX - SECTION 2.0
#	      Windows: See MySQL_README_WINDOWS - SECTION 2.0
#

# Start: Create the database
CREATE DATABASE IF NOT EXISTS SHeroDB;
USE SHeroDB;
GRANT SELECT ON `SHeroDB`.* TO SuperHeroModUser@localhost;


#----------------------------------------------------
# Start: Create the tables
#----------------------------------------------------

CREATE TABLE IF NOT EXISTS `sh_savexp` (
	`SH_KEY` varchar(32) binary NOT NULL default '',
	`PLAYER_NAME` varchar(32) binary NOT NULL default '',
	`LAST_PLAY_DATE` timestamp(14) NOT NULL,
	`XP` int(10) NOT NULL default '0',
	`HUDHELP` tinyint(3) unsigned NOT NULL default '1',
	`SKILL_COUNT` tinyint(3) unsigned NOT NULL default '0',
	PRIMARY KEY  (`SH_KEY`)
) TYPE=MyISAM COMMENT='SUPERHERO XP Saving Table';

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER ON `sh_savexp` TO SuperHeroModUser@localhost;

CREATE TABLE IF NOT EXISTS `sh_saveskills` (
	`SH_KEY` varchar(32) binary NOT NULL default '',
	`SKILL_NUMBER` tinyint(3) unsigned NOT NULL default '0',
	`HERO_NAME` varchar(25) NOT NULL default '',
	PRIMARY KEY  (`SH_KEY`,`SKILL_NUMBER`)
) TYPE=MyISAM COMMENT='SUPERHERO Skill Saving Table';

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER ON `sh_saveskills` TO SuperHeroModUser@localhost;

FLUSH PRIVILEGES;

#----------------------------------------------------
# Stop
#----------------------------------------------------
GRANT SELECT ON `SHeroDB`.* TO SuperHeroModUser@localhost;

^^^ i did change sherodb to ub_superhero (my database name), and superheromoduser to ub (my username) IDENTIFIED BY "mypassword", and left localhost cuz im trying to use phpmyadmin to import this .sql from my pc.

what exactly would I need to change to make it work , i tried this for 3 hours yesterday :oops:
User avatar
Edge100x
Founder
Founder
Posts: 13113
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: phpmyadmin cant import .sql

Post by Edge100x »

Do a search and replace for "SHeroDB", changing it to your new database name.
Comment out every line starting with "GRANT".
Comment out every line starting with "CREATE DATABASE".
Comment out "FLUSH PRIVILEGES".
12114
A semi-regular
A semi-regular
Posts: 20
Joined: Wed Dec 19, 2012 6:19 pm

Re: phpmyadmin cant import .sql

Post by 12114 »

ok sir i did this...

Code: Select all

# Start: Create the database
# CREATE DATABASE IF NOT EXISTS SHeroDB;
USE ub_superhero;
# GRANT SELECT ON `SHeroDB`.* TO SuperHeroModUser@localhost;


#----------------------------------------------------
# Start: Create the tables
#----------------------------------------------------

CREATE TABLE IF NOT EXISTS `sh_savexp` (
	`SH_KEY` varchar(32) binary NOT NULL default '',
	`PLAYER_NAME` varchar(32) binary NOT NULL default '',
	`LAST_PLAY_DATE` timestamp(14) NOT NULL,
	`XP` int(10) NOT NULL default '0',
	`HUDHELP` tinyint(3) unsigned NOT NULL default '1',
	`SKILL_COUNT` tinyint(3) unsigned NOT NULL default '0',
	PRIMARY KEY  (`SH_KEY`)
) TYPE=MyISAM COMMENT='SUPERHERO XP Saving Table';

# GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER ON `sh_savexp` TO SuperHeroModUser@localhost;

CREATE TABLE IF NOT EXISTS `sh_saveskills` (
	`SH_KEY` varchar(32) binary NOT NULL default '',
	`SKILL_NUMBER` tinyint(3) unsigned NOT NULL default '0',
	`HERO_NAME` varchar(25) NOT NULL default '',
	PRIMARY KEY  (`SH_KEY`,`SKILL_NUMBER`)
) TYPE=MyISAM COMMENT='SUPERHERO Skill Saving Table';

# GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER ON `sh_saveskills` TO SuperHeroModUser@localhost;

# FLUSH PRIVILEGES;

#----------------------------------------------------
# Stop
#----------------------------------------------------




and i get this error:

Code: Select all

Error

SQL query: Documentation

# GRANT SELECT ON `SHeroDB`.* TO SuperHeroModUser@localhost;
#----------------------------------------------------
# Start: Create the tables
#----------------------------------------------------
CREATE TABLE IF NOT EXISTS `sh_savexp` (
`SH_KEY` varchar( 32 ) BINARY NOT NULL default '',
`PLAYER_NAME` varchar( 32 ) BINARY NOT NULL default '',
`LAST_PLAY_DATE` timestamp( 14 ) NOT NULL ,
`XP` int( 10 ) NOT NULL default '0',
`HUDHELP` tinyint( 3 ) unsigned NOT NULL default '1',
`SKILL_COUNT` tinyint( 3 ) unsigned NOT NULL default '0',
PRIMARY KEY ( `SH_KEY` )
) TYPE = MYISAM COMMENT = 'SUPERHERO XP Saving Table';

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(14) NOT NULL,
    `XP` int(10) NOT NULL default '0',
    `HUDHELP` tinyint(3) unsig' at line 11 
User avatar
Edge100x
Founder
Founder
Posts: 13113
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: phpmyadmin cant import .sql

Post by Edge100x »

It appears that they made a mistake in the file. You could try to compensate by manually creating the table by hand with the columns that they appear to need, or by exporting the database from another working installation and importing it here.
Post Reply