How to import several databases at once through PhpMyAdmin?

Mistake

SQL query:

--
-- Database: `attend`
--

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

--
-- Table structure for table `attend`
--

CREATE TABLE IF NOT EXISTS `attend` (
  `id` int(5) NOT NULL AUTO_INCREMENT,
  `name` varchar(15) NOT NULL DEFAULT 'name',
  `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `timeing` time NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=14 ;

MySQL said: Documentation
#1046 - No database selected 

I am migrating my databases. I exported the entire database at once.
Therefore, during import, I cannot select a separate database.
And, by directly importing the sql file, I get the above error.

Possible solutions found on the phpmyadmin database import error
But I don’t know how to implement this solution for about 30 databases in the .sql file
Please help me since I deleted the old database after exporting the entire database and you need to import mASAP.

+4
source share
3

, SQL , , , . :

A) , . - , .

B) , , . , , . , . :

USE `database_name`;

database_name , .


, , :

CREATE TABLE IF NOT EXISTS `attend` (

CREATE TABLE IF NOT EXISTS `database_name`.`attend` (

database_name , .

+6

phpMyAdmin 4.1 , , " CREATE DATABASE/USE". - , .

+1

as stated in askubuntu.com you can use:

-export using: mysqldump -u username -p –-all-databases > dump.sql
-import using:mysql -u username -p < dump.sql

0
source

Source: https://habr.com/ru/post/1529626/


All Articles