How Do I insert my DB Correctly?

Discussion in 'MySQL' started by jimmyb29, Feb 11, 2014.

  1. #1
    I'm new to this and don't know how to put this into my site. Any help appreciated!

    Thanks!

    jimmyb


    # MySQL-Front Dump 2.2
    #
    # Host: 90.0.0.101 Database: guest_book_db
    #--------------------------------------------------------
    # Server version 4.1.21-community-nt


    #
    # Table structure for table 'tbl_admin'
    #

    CREATE TABLE `tbl_admin` (
    `Id` int(6) unsigned NOT NULL auto_increment,
    `admin_loginname` varchar(25) default NULL,
    `admin_password` varchar(25) default NULL,
    PRIMARY KEY (`Id`)
    ) ENGINE=MyISAM;



    #
    # Dumping data for table 'tbl_admin'
    #
    INSERT INTO tbl_admin VALUES("1","admin","admin");


    #
    # Table structure for table 'tbl_color'
    #

    CREATE TABLE `tbl_color` (
    `auto_id` int(11) unsigned NOT NULL auto_increment,
    `color` varchar(255) default NULL,
    PRIMARY KEY (`auto_id`)
    ) ENGINE=InnoDB;



    #
    # Dumping data for table 'tbl_color'
    #
    INSERT INTO tbl_color VALUES("1","#33CCFF");


    #
    # Table structure for table 'tbl_guest_book'
    #

    CREATE TABLE `tbl_guest_book` (
    `auto_id` bigint(20) unsigned NOT NULL auto_increment,
    `customer_name` varchar(255) default NULL,
    `customer_email` varchar(255) default NULL,
    `customer_comments` text,
    `created_date` datetime default NULL,
    `status` char(1) default 'N',
    PRIMARY KEY (`auto_id`),
    UNIQUE KEY `auto_id` (`auto_id`)
    ) ENGINE=InnoDB;



    #
    # Dumping data for table 'tbl_guest_book'
    #
    I# Table structure for table 'tbl_image'
    #

    CREATE TABLE `tbl_image` (
    `pk_image_id` bigint(20) NOT NULL auto_increment,
    `image_name` varchar(255) default NULL,
    PRIMARY KEY (`pk_image_id`),
    UNIQUE KEY `pk_image_id` (`pk_image_id`)
    ) ENGINE=InnoDB;



    #
    # Dumping data for table 'tbl_image'
    #
    INSERT INTO tbl_image VALUES("8","AW004634.jpg");
     
    jimmyb29, Feb 11, 2014 IP
  2. Iconiplex

    Iconiplex Member

    Messages:
    119
    Likes Received:
    9
    Best Answers:
    2
    Trophy Points:
    43
    #2
    Save that as something like "import.sql" then go to your host control panel (usually cPanel), then go into phpMyAdmin. Note you will need to already have a database and database user created, which can easily be done from your control panel.

    Once in phpMyAdmin, make sure your database is selected, go to "Import" at the top, then select SQL from the drop-down menu and choose your file. Leave the default settings, then import it.

    On a side note, you just shared your entire database structure on the public Web, which would give any security consultant a heart attack on the spot. Beyond that, you also shared your admin username and password (unless you prudently masked these). Beyond that, your passwords are stored in plaintext, when they should be hashed. Or if they are hashed and you removed the info since you posted it here, I see your password field is only 25 characters long, meaning it's not being salted and hashed with the latest basic and proper hashing algorithms, never mind any type of advanced encryption.
     
    Iconiplex, Feb 11, 2014 IP
  3. jimmyb29

    jimmyb29 Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #3
    Hi, Iconiplex,

    Thanks for the prompt reply! I'm 85 years old, and was very tired when I posted the original file. I checked it just now, but didn't see any Username or Password. I'll change the password.

    Thanks again,

    Jimmyb
     
    jimmyb29, Feb 12, 2014 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    In the first bulk of code, you're creating the tbl_admin, where you'll see that two of the column-names are admin_loginname and admin_password - then underneath that, you populate that table with, among other things, 'admin' / 'admin' - hence username/password (and a non-hashed password at that)
    Besides, posting the complete table-setup is usually a bad idea (not too bad in this case, as there's no information about WHERE these tables are placed) since it potentially gives more attack-vectors if anyone wants to get into your site via flaws / SQL-injections etc.
     
    PoPSiCLe, Feb 12, 2014 IP