Jump to content

Query insertion needs userid password


russia5

Recommended Posts

I am uploading a script.  It has a MySQL file which I have successfully uploaded to create a database and It has a query file which is suppose to creat a table and populate it.  The database was successfully made,  however when I place the query file in myphpadmin, either by the import feature or the cut and paste feature, I get an error telling me I need the usr id and password.  Here is the query:

 


USE book_sc;


INSERT INTO books VALUES ('0672317842','Luke Welling and Laura Thomson','PHP and MySQL Web Development',1,49.99,
'PHP & MySQL Web Development teaches the reader to develop dynamic, secure e-commerce web sites. You will learn to integrate and implement these technologies by following real-world examples and working sample projects.');
INSERT INTO books VALUES ('0672318040','Matt Zandstra','Sams Teach Yourself PHP4 in 24 Hours',1,24.99,
'Consisting of 24 one-hour lessons, Sams Teach Yourself PHP4 in 24 Hours is divided into five sections that guide you through the language from the basics to the advanced functions.');
INSERT INTO books VALUES ('0672319241','Sterling Hughes and Andrei Zmi','PHP Developer\'s Cookbook',1,39.99,
'Provides a complete, solutions-oriented guide to the challenges most often faced by PHP developers\r\nWritten specifically for experienced Web developers, the book offers real-world solutions to real-world needs\r\n');

INSERT INTO categories VALUES (1,'Internet');
INSERT INTO categories VALUES (2,'Self-help');
INSERT INTO categories VALUES (5,'Fiction');
INSERT INTO categories VALUES (4,'Gardening');

INSERT INTO admin VALUES ('admin', sha1('admin'));

 

The database has no tables presently.

 

I see no place to put the user id and password so the query will work.  I assume it is the database usrid and passord.  Does anyone know where to put it so the database will be populated?

Link to comment
Share on other sites

there are no table creation scripts in there,just insert scripts,

The USE db_name  statement tells MySQL to use the db_name database as the default (current) database for subsequent statements. The database remains the default until the end of the session or another USE statement is issued.

if the database has been created ( book_sc I presume) and no tables are present, then the insert scripts cannot insert into a table that does not exist

Link to comment
Share on other sites

Thankyou very much.

 

I have now created the tables.  I had to do it long hand, because the code to create the tables would not work, because when I plugged it into myphpadmin, I got the error below:  ie) you can not access the database because of the wrong userid and password.

 

Now, when I put in the above query to populate the tables:

 

USE book_sc;


INSERT INTO books VALUES ('0672317842','Luke Welling and Laura Thomson','PHP and MySQL Web Development',1,49.99,
'PHP & MySQL Web Development teaches the reader to develop dynamic, secure e-commerce web sites. You will learn to integrate and implement these technologies by following real-world examples and working sample projects.');
INSERT INTO books VALUES ('0672318040','Matt Zandstra','Sams Teach Yourself PHP4 in 24 Hours',1,24.99,
'Consisting of 24 one-hour lessons, Sams Teach Yourself PHP4 in 24 Hours is divided into five sections that guide you through the language from the basics to the advanced functions.');
INSERT INTO books VALUES ('0672319241','Sterling Hughes and Andrei Zmi','PHP Developer\'s Cookbook',1,39.99,
'Provides a complete, solutions-oriented guide to the challenges most often faced by PHP developers\r\nWritten specifically for experienced Web developers, the book offers real-world solutions to real-world needs\r\n');

INSERT INTO categories VALUES (1,'Internet');
INSERT INTO categories VALUES (2,'Self-help');
INSERT INTO categories VALUES (5,'Fiction');
INSERT INTO categories VALUES (4,'Gardening');

INSERT INTO admin VALUES ('admin', sha1('admin'));


 

I still get the same error:

 


MySQL said:  

#1044 - Access denied for user: 'russia5@localhost' to database 'book_sc' 

 

Does anyone know how to get the site to accept the query.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.