Results 1 to 9 of 9
  1. #1
    Join Date
    Feb 2015
    Posts
    4

    Unanswered: Export/Import failure

    Hi.

    I'm trying to export/import a file from an old webserver to a Network Solutions hosted MySQL database.

    On my first try, it said "no database selected". I figured out that I needed to edit the export and add the command "USE DATABASENAME".

    But then it quits saying there is a syntax error and probably a version error. However, when I look at the information about MySQL versions, they both appear to be version 5.

    One googled solution said "try using the SQL323 compatibility setting on both sides." That didn't work.

    When the error says "Near", does that mean that the information shown IS the problem code? I find "Near" confusing.

    I'm trying to understand what I should be doing next.
    Should I be looking at this "Create table" command and looking at MySQL documentation to see how this command might not be constructed properly?

    Thanks,

    Ed


    ----------------------------------------------
    See error below:
    Error
    SQL query:

    -- -- Database: 'acmedb' -- USE ACMEDB -- -------------------------------------------------------- -- -- Table structure for table 'sendcard' -- CREATE TABLE IF NOT EXISTS 'sendcard' ( 'image' varchar(150) default NULL, 'caption' text, 'bgcolor' varchar(7) default NULL, 'towho' varchar(50) default NULL, 'to_email' varchar(50) NOT NULL, 'fromwho' varchar(50) default NULL, 'from_email' varchar(50) NOT NULL, 'fontcolor' varchar(7) default NULL, 'fontface' varchar(100) default NULL, 'message' text, 'music' varchar(70) default NULL, 'id' varchar(25) NOT NULL, 'notify' char(1) default '1', 'emailsent' char(1) default '1', 'template' varchar(30) default NULL, 'des' varchar(30) default NULL, 'img_width' char(3) default NULL, 'img_height' char(3) default NULL, 'applet_name' char(40) default NULL, 'user1' varchar(50) default NULL, 'user2' varchar(50) default NULL, 'user3' varchar(50) default NULL,[...]

    MySQL said:

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE IF NOT EXISTS 'sendcard' (
    'image' varchar(150) default NULL,
    ' at line 13

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    The near message tells you thats the point where MySQL detected there was a problem. It doesnt neccesarily mean thats the line with the problem but thats the poi t it realised a problem occured.
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Feb 2015
    Posts
    4

    reply

    Well that's the very first line of code following the first line which I added.
    I added "USE ACMEDB".

    Perhaps the only thing I added I ADDED WRONG!!!!

    I thought that was the proper syntax for opening a database from what I looked up, but maybe I left something out? Quotes or something else?
    Without that first line, the original import error was "no database selected".

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    can you include your script inside [ c o d e ] & [ / c o d e ] tags (without the spaces, so [ / c o d e ] becomes [/code]). that should include the formatting & line breaks
    right now its a mess, there is no way of knowiung what is a new line, what is a comment
    the most likely reason is there should be a semi colon AFTER each SQL statement, so I'm expecting it should read somethign like:-
    Code:
    USE ACMEDB;
     -- -------------------------------------------------------- --
     -- Table structure for table 'sendcard' -- 
    CREATE TABLE IF NOT EXISTS 'sendcard' ( 'image' varchar(150) default NULL, 'captio....
    as a general rule if the previous attempt to run the code reported a different error, and you have added new code BEFORE the line reporting that error then thats where the new error lies.*

    *this is, Im led to belive a quote from the "no sh!t, Sherlock" school of philosophy
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Feb 2015
    Posts
    4
    you're absolutely right. what a "newbie" error! proof of how little I know. I'm not a programmer, just trying to manage this export/import process.
    I did discover that semi-colon thing myself and got the import to go a LITTLE farther!

    Now I guess I need to be looking at how to create a proper "Create Table" statement.
    I've already noticed that this old code is filled with single quotes whereas some other new code I've seen doesn't seem to have ANY quotes.

    Thanks for your patience in helping me debug this.

    Ed

    ----------------------------------------------------

    Error
    SQL query:

    -- -------------------------------------------------------- -- -- Table structure for table 'sendcard' -- CREATE TABLE IF NOT EXISTS 'sendcard' ( 'image' varchar(150) default NULL, 'caption' text, 'bgcolor' varchar(7) default NULL, 'towho' varchar(50) default NULL, 'to_email' varchar(50) NOT NULL, 'fromwho' varchar(50) default NULL, 'from_email' varchar(50) NOT NULL, 'fontcolor' varchar(7) default NULL, 'fontface' varchar(100) default NULL, 'message' text, 'music' varchar(70) default NULL, 'id' varchar(25) NOT NULL, 'notify' char(1) default '1', 'emailsent' char(1) default '1', 'template' varchar(30) default NULL, 'des' varchar(30) default NULL, 'img_width' char(3) default NULL, 'img_height' char(3) default NULL, 'applet_name' char(40) default NULL, 'user1' varchar(50) default NULL, 'user2' varchar(50) default NULL, 'user3' varchar(50) default NULL, 'send_time' bigint(20) NOT NULL, 'time_created' bigint[...]

    MySQL said:

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''sendcard' (
    'image' varchar(150) default NULL,
    'caption' text,
    'bgcolo' at line 7



    Code
    --------------------------------------
    --
    -- Table structure for table 'sendcard'
    --

    CREATE TABLE IF NOT EXISTS 'sendcard' (
    'image' varchar(150) default NULL,
    'caption' text,
    'bgcolor' varchar(7) default NULL,
    'towho' varchar(50) default NULL,
    'to_email' varchar(50) NOT NULL,
    'fromwho' varchar(50) default NULL,
    'from_email' varchar(50) NOT NULL,
    'fontcolor' varchar(7) default NULL,
    'fontface' varchar(100) default NULL,
    'message' text,
    'music' varchar(70) default NULL,
    'id' varchar(25) NOT NULL,
    'notify' char(1) default '1',
    'emailsent' char(1) default '1',
    'template' varchar(30) default NULL,
    'des' varchar(30) default NULL,
    'img_width' char(3) default NULL,
    'img_height' char(3) default NULL,
    'applet_name' char(40) default NULL,
    'user1' varchar(50) default NULL,
    'user2' varchar(50) default NULL,
    'user3' varchar(50) default NULL,
    'send_time' bigint(20) NOT NULL,
    'time_created' bigint(20) default NULL,
    'ip_address' varchar(15) default NULL,
    'sc_language' varchar(2) default NULL,
    PRIMARY KEY ('id')
    ) TYPE=MyISAM;

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    please make certaint that anything you post here that is sample code is done so encapsualted by code tags, it makes it easier to read. and making it easier to read also makes it easier for others to offer their time to help you. failing to do just make many's eye's glaze over
    in the 'advanced' post page yiou can select the # icon to do it for you, OR do it manually as advised above
    Last edited by healdem; 02-03-15 at 19:07.
    I'd rather be riding on the Tiger 800 or the Norton

  7. #7
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    do you actually need a 'blob data type (Text for the caption)

    depends ion what engine you are using you may not be able to use a varchar for a primary key
    I'd rather be riding on the Tiger 800 or the Norton

  8. #8
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    ...god knows where you got that style of DDL from, I haveseevre doubts it works for \MySQL
    hackign your DDL script in Workbench suggests the following will work
    Code:
    CREATE TABLE IF NOT EXISTS sendcard
    (
    image varchar(150) default NULL,
    caption text,
    bgcolor varchar(7) default NULL,
    towho varchar(50) default NULL,
    to_email varchar(50) NOT NULL,
    fromwho varchar(50) default NULL,
    from_email varchar(50) NOT NULL,
    fontcolor varchar(7) default NULL,
    fontface varchar(100) default NULL,
    message text,
    music varchar(70) default NULL,
    id varchar(25) NOT NULL,
    notify char(1) default '1',
    emailsent char(1) default '1',
    template varchar(30) default NULL,
    des varchar(30) default NULL,
    img_width char(3) default NULL,
    img_height char(3) default NULL,
    applet_name char(40) default NULL,
    user1 varchar(50) default NULL,
    user2 varchar(50) default NULL,
    user3 varchar(50) default NULL,
    send_time bigint(20) NOT NULL,
    time_created bigint(20) default NULL,
    ip_address varchar(15) default NULL,
    sc_language varchar(2) default NULL,
    PRIMARY KEY (id)
    )
     Engine = MyISAM;
    note
    1) not using ', I thinbk you can use the back tick symbol but not the ' symbol
    2) replace type =... with engine = ....
    I'd rather be riding on the Tiger 800 or the Norton

  9. #9
    Join Date
    Feb 2015
    Posts
    4
    Thanks to all who have been kicking in their ideas. I am actually making progress.
    I was able to successfully import the sql file into the Network Solutions database! (see documentation for that at the bottom of this reply)

    But now the Network Solutions site won't let me connect to the database. Says the password is bad.
    Maybe this is a Network Solutions question at this point, but I don't know if they have the coding expertise to be able to help. They have been more about the hosting, not so much about programming.

    I find it interesting that the error message from the site showed the userid (acmeid) but the password shows as a variable. Is this by design so that passwords aren't exposed? But it's ok to show the userid?
    It seems to be pointing to this "connect" statement. Is it possible that localhost needs to be defined as some specific Network Solutions host rather than a default of "localhost"?


    error msg
    -------------------------------
    Warning: mysql_connect(): No connection could be made because the target machine actively refused it. in \\WDP\DFS\30\6\5\0\3067639056\user\sites\3847737.s ite\www\site\sitesub\include\db_mysql.php on line 73
    Database error: connect(localhost, acmeid, $Password) failed.
    MySQL Error: ()
    Session halted.


    for documentation on this thread
    -------------------------------
    Here's what I ended up doing to make the import work.
    * I used the MYSQL40 option from myPHPAdmin on both the export and the import. (323 worked for someone else, 40 for me)
    * I had to manually add the "use databasename;" to the export before doing the import.
    * Then Network Solutions was totally happy with the import, even with the presence of quotes, both " ` " and " ' ".
    * There was a php "setup" file that had the user id and password coded in. I had to modify that to match the new database password created for the Network Solutions database. (had to be a stronger
    password on the Network Solutions side).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •