#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
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.
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?
Re: V.1.5.4 - #1046 - No database selected
Quote:
Originally Posted by
Lucas Cattell
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?
Re: V.1.5.4 - #1046 - No database selected
Quote:
Originally Posted by
Lucas Cattell
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
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
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