Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2015
    Location
    Cooma, New South Wales, Australia
    Posts
    2
    Plugin Contributions
    0

    Default #1046 - No database selected

    Hello,

    I am desperately trying to reinstall my website from a back up, after our website crashed. I have upgraded from V.1.3.8 to V.1.5.4, however when I install my database I get the following error.

    -- Table structure for table `address_book`
    --

    CREATE TABLE IF NOT EXISTS `address_book` (
    `address_book_id` int(11) NOT NULL AUTO_INCREMENT,
    `customers_id` int(11) NOT NULL DEFAULT '0',
    `entry_gender` char(1) NOT NULL DEFAULT '',
    `entry_company` varchar(64) DEFAULT NULL,
    `entry_firstname` varchar(32) NOT NULL DEFAULT '',
    `entry_lastname` varchar(32) NOT NULL DEFAULT '',
    `entry_street_address` varchar(64) NOT NULL DEFAULT '',
    `entry_suburb` varchar(32) DEFAULT NULL,
    `entry_postcode` varchar(10) NOT NULL DEFAULT '',
    `entry_city` varchar(32) NOT NULL DEFAULT '',
    `entry_state` varchar(32) DEFAULT NULL,
    `entry_country_id` int(11) NOT NULL DEFAULT '0',
    `entry_zone_id` int(11) NOT NULL DEFAULT '0',
    PRIMARY KEY (`address_book_id`),
    KEY `idx_address_book_customers_id_zen` (`customers_id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=32 ;
    MySQL said: Documentation

    #1046 - No database selected


    I have searched the forum and I haven't been able to find an answer, so I apologise if I am covering an issue already discussed.

    Your help would be greatly appreciated.

    Lucas

  2. #2
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,731
    Plugin Contributions
    27

    Default Re: V.1.5.4 - #1046 - No database selected

    The beginning of your .sql backup should have a defining line like this:
    --
    -- Database: `this_is_the_name_of_your_sql_database`
    --

    If the name does not match the database you have setup, you will not be able to continue with the next line that's trying to 'create' table structure.
    Twitch.
    https://www.twitchtoo.com Do you work for free? Please donate.
    Twitch Base7 with Wholesale PRO - 88 preinstalled plugins zero errors.

  3. #3
    Join Date
    Feb 2015
    Location
    Cooma, New South Wales, Australia
    Posts
    2
    Plugin Contributions
    0

    Default Re: V.1.5.4 - #1046 - No database selected

    The database names did not match by one letter (typo) so it fixed it, thanks.

    However, now I get WARNING: An Error occurred, please refresh the page and try again.

    PHP Fatal error: 1146:Table 'my_database.sessions' doesn't exist :: select value
    from sessions
    where sesskey = 'd1b2b558009a60aefa2591a6d27ece8f'
    and expiry > '1424047607' ==> (as called by) /home/mywebsite/public_html/includes/functions/sessions.php on line 45 <== in /home/mywebsite/public_html/includes/classes/db/mysql/query_factory.php on line 155

    How do I fix this?

  4. #4
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,731
    Plugin Contributions
    27

    Default Re: V.1.5.4 - #1046 - No database selected

    Quote Originally Posted by Lucas Cattell View Post
    The database names did not match by one letter (typo) so it fixed it, thanks.

    However, now I get WARNING: An Error occurred, please refresh the page and try again.

    PHP Fatal error: 1146:Table 'my_database.sessions' doesn't exist :: select value
    from sessions
    where sesskey = 'd1b2b558009a60aefa2591a6d27ece8f'
    and expiry > '1424047607' ==> (as called by) /home/mywebsite/public_html/includes/functions/sessions.php on line 45 <== in /home/mywebsite/public_html/includes/classes/db/mysql/query_factory.php on line 155

    How do I fix this?
    Same thing here, the error is telling you that the table you are trying to create or access doesn't exist. so 'my_database.sessions' should most likely read 'sessions' unless you have a prefix on your tables?
    Twitch.
    https://www.twitchtoo.com Do you work for free? Please donate.
    Twitch Base7 with Wholesale PRO - 88 preinstalled plugins zero errors.

  5. #5
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: V.1.5.4 - #1046 - No database selected

    Quote Originally Posted by Lucas Cattell View Post
    The database names did not match by one letter (typo) so it fixed it, thanks.
    Forgive my pedantry, but there should only be ONE database name in the .sql backup file. The fact that you stated 'names' leads me to believe that you could have changed more than you should have. (Unless you have a unchanged backup I hope I'm wrong about this).

    Quote Originally Posted by Lucas Cattell View Post
    However, now I get WARNING: An Error occurred, please refresh the page and try again.

    PHP Fatal error: 1146:Table 'my_database.sessions' doesn't exist
    Would I be wrong in assuming that you have possibly edited this text and replaced the *real* database name with "my_database", or is that literally what the error message says?

    Quote Originally Posted by Lucas Cattell View Post
    How do I fix this?
    At this stage I couldn't tell you because it depends very much on whether my assumption is correct or not, as well as if there were multiple database names, rather than just the one.

    Please clarify.

    Cheers
    RodG

 

 

Similar Threads

  1. v152 How can copy some products from database to another database ?
    By dmagic in forum General Questions
    Replies: 5
    Last Post: 2 Jul 2018, 02:54 PM
  2. Replies: 3
    Last Post: 11 Mar 2011, 10:56 AM
  3. Mass delete selected meta tag in database
    By beep in forum General Questions
    Replies: 3
    Last Post: 11 Aug 2010, 02:16 PM
  4. integrate/map new Mysql database with existing zencart database
    By omerhanif in forum General Questions
    Replies: 0
    Last Post: 18 Jan 2010, 12:36 PM
  5. Replies: 4
    Last Post: 14 Dec 2007, 01:04 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR