Announcement

Collapse
No announcement yet.

Restoring a Database (SSH2)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Restoring a Database (SSH2)

    I'm using AbsoluteTelnet using the SSH2 method to restore just the "posts" table (15megs - too big for phpmyadmin)

    I can't get the right string to restore the database though. I'm trying

    mysql mypassword mydatabasename < post.sql

    I'm running it exactly like that, what am i doing wrong?

  • #2
    Generally, mysql uploads require you to use the following:

    mysql -u username -p (which will prompt for password) database name < path/to/sql file.

    You left out the -u, username, -p, and the <. The < points to where the data is going, in this case to "databasename." Using the > indicates the data is coming "from" databasename, as in making a backup.

    So you should have:

    mysql -u username -p mydatabasename < post.sql
    (when you hit enter, you will be prompted for the password)

    This ASSUMES that post.sql is sitting in your root folder.

    I don't believe you need the "&lt;" because your "post" backup file should have something in it which states like the following (v3.0.3) :

    DROP TABLE IF EXISTS post;
    CREATE TABLE post (
    postid int(10) unsigned NOT NULL auto_increment,
    threadid int(10) unsigned NOT NULL default '0',
    username varchar(50) NOT NULL default '',
    userid int(10) unsigned NOT NULL default '0',
    title varchar(250) NOT NULL default '',
    dateline int(10) unsigned NOT NULL default '0',
    pagetext mediumtext NOT NULL,
    allowsmilie smallint(6) NOT NULL default '0',
    showsignature smallint(6) NOT NULL default '0',
    ipaddress varchar(16) NOT NULL default '',
    iconid smallint(5) unsigned NOT NULL default '0',
    visible smallint(6) NOT NULL default '0',
    parentid int(10) unsigned NOT NULL default '0',
    attach smallint(5) unsigned NOT NULL default '0',
    PRIMARY KEY (postid),
    KEY iconid (iconid),
    KEY userid (userid),
    KEY threadid (threadid,userid)
    ) TYPE=MyISAM;

    followed by:

    LOCK TABLES post WRITE;
    INSERT INTO post VALUES (all the contents of the posts table.)
    UNLOCK TABLES;

    Again this is ASSUMING the sql file has nothing in it but the Post database, which is what you said.

    Regards,
    Last edited by slappy; Wed 28 Jul '04, 12:35am.
    Slappy

    Comment


    • #3
      try

      mysql -uUSERNAME -pmypassword mydatabasename < /path/to/database.sql

      Comment


      • #4
        Thanks guys but that didn't work also.

        I get this message:



        ERROR 2002: Can't connect to local MySQL server through socket /home/virtual/FILESSYSYEMTEMPLATE/.mysqlsock/mysql.sock (2)



        My host told me i was supposed to run this:

        mysql -p dbname &lt; file.sql


        Please help!

        Comment


        • #5
          Looks like your MySQL server isn't running.
          TheologyWeb. We debate theology. srsly.

          Comment


          • #6
            This error means either MySQL crashed, it's not running or it can't find the socket. You need to contact your host about this. Here is more info on this error:

            http://dev.mysql.com/doc/mysql/en/Ca...to_server.html
            Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
            Change CKEditor Colors to Match Style (for 4.1.4 and above)

            Steve Machol Photography


            Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


            Comment


            • #7
              For the benefit of those less familiar with mySQL, -uUSERNAME means the actual username. -pMYPASSWORD means the actual password. I'm sure his host would know whether or not mySQL was not running

              Signed,

              Umm... His Friendly Host

              Comment


              • #8
                Using the "actual username" and "actual databasename" certainly does help make it work the way it's supposed to. :-)

                Although there was a "slight" chance that your "user" didn't know and actually chose "username" for his "username" and "mydatabasename" for his databasename..... Nah. :-)

                Regards,
                Slappy

                Comment


                • #9
                  I certainly intended no disrespect. He has been an excellent customer and since I remember when I first started - well, we try to help the best that we can.

                  Comment


                  • #10
                    And I was only reflecting on the irony of people perhaps being too "literal" in interpreting proposed solutions. :-)

                    Regards,
                    Slappy

                    Comment

                    Loading...
                    Working...
                    X