Receiving the following error message:
Error
Static analysis:
1 errors were found during analysis.
This option conflicts with "AUTO_INCREMENT". (near "AUTO_INCREMENT" at position 692)
SQL query:
— phpMyAdmin SQL Dump — version 2.8.2.4 — http://www.phpmyadmin.net — — Host: localhost:3306 — Generation Time: Mar 23, 2020 at 03:58 PM — Server version: 5.0.45 — PHP Version: 5.2.3 — — Database: weir-jones
— — ——————————————————– — — Table structure for table categories
— CREATE TABLE categories
( number
int(11) NOT NULL auto_increment, section
varchar(255) NOT NULL, parent_id
varchar(10) NOT NULL, title
varchar(200) NOT NULL, type
varchar(255) NOT NULL, content
text NOT NULL, display_order
int(11) NOT NULL, PRIMARY KEY (number
) ) ENGINE=MyISAM AUTO_INCREMENT=126 DEFAULT CHARSET=utf8 AUTO_INCREMENT=126
MySQL said: Documentation
1046 – No database selected
============================================
I have tried importing with all compatibility modes. No luck.
old database is gone, cannot export again.
Any help would be appreciated.
Brendan
2
Answers
If you ask for the
1046 No database selected
then it is what it means. You exported a table from a database without theUSE xxx
.So I would suggest try importing this within a database or add the
USE
clause on top on your SQL file.Another thing:
If you ask a question on Stackoverflow make sure to read the “formatting rules”. Wich means you can organzie your question.
It is actually quite hard to read what error you have. Use emphasis, code blocks and such things like:
By this someone can better read what is code and what is the error and of course what is the actual question.
Eurobetics is correct, this is because the .sql file doesn’t specify what database to work with. That’s no problem, you can just create the database on your new server and import the file in to that. Since you’re importing through phpMyAdmin, first use the “New” text in the left-hand navigation area to create a new database (you don’t need to put any tables in it). Once the database is created, phpMyAdmin puts you in the database structure page. (If you happen to navigate away or are coming back after you’ve already created the database, just click the existing database in the navigation pane). Look at the tabs along the top row and use the “Import” tab there (or drag and drop your .sql file here).
Being inside that database page tells phpMyAdmin that you want to import to that database specifically, whereas if you’re on the main home page, the Import button there isn’t attached to any particular database, which leads to your error.
You could technically add the SQL commands to create the database and USE the database in to the .sql file, but in this case that doesn’t seem like it’s needed and would just be making more work for you.