homie_g Posted August 20, 2003 Share Posted August 20, 2003 how do i use a .sql file to create database(s) and tables? Quote Link to comment Share on other sites More sharing options...
DylanBlitz Posted August 20, 2003 Share Posted August 20, 2003 a .sql file is basically a flat text file that will create your tables and insert data when you put yoru fields in. Mostly what I\'ve used them for is backup. I load phpmyadmin, click export, and then export a .sql file which will create everything again if it goes down. Here is a sample of some stuff. You create the db on your own, then here is a table: DROP TABLE IF EXISTS `button`; CREATE TABLE `button` ( `butt_id` int(11) NOT NULL auto_increment, `butt_name` varchar(150) NOT NULL default \'\', `butt_action` varchar(150) default NULL, `butt_link` varchar(150) NOT NULL default \'\', PRIMARY KEY (`butt_id`) ) TYPE=MyISAM AUTO_INCREMENT=64; That tells the mysql that if the db already has a \"button\" table to get rid of it and create one with these fields. Then you insert data into it: INSERT INTO `button` VALUES (10, \'News - Add\', \'add\', \'admin_news.php\'); INSERT INTO `button` VALUES (11, \'News - Modify\', \'modify\', \'admin_news.php\'); INSERT INTO `button` VALUES (12, \'News - Delete\', \'delete\', \'admin_news.php\'); Hope that helps you. If it\'s not what you meant then let me know Quote Link to comment Share on other sites More sharing options...
homie_g Posted August 20, 2003 Author Share Posted August 20, 2003 thanx. im using mysql on my harddrive for testing etc. and im i n00b :oops: i no how to import from a .txt file but how to do export to a .txt file? Quote Link to comment Share on other sites More sharing options...
DylanBlitz Posted August 20, 2003 Share Posted August 20, 2003 are you using phpmyadmin? if you are then it defaults to db.sql 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.