russia5 Posted February 7, 2007 Share Posted February 7, 2007 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? Quote Link to comment Share on other sites More sharing options...
paul2463 Posted February 7, 2007 Share Posted February 7, 2007 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 Quote Link to comment Share on other sites More sharing options...
fenway Posted February 7, 2007 Share Posted February 7, 2007 You can run a "create table if not exists"... Quote Link to comment Share on other sites More sharing options...
russia5 Posted February 8, 2007 Author Share Posted February 8, 2007 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. Quote Link to comment Share on other sites More sharing options...
fenway Posted February 8, 2007 Share Posted February 8, 2007 Well, if access is denied, you don't have the proper credentials -- check the grants table. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.