• Resolved johnhardy

    (@johnhardy)


    I am trying to make a backup of a database in phpmyadmin. This seems to go OK but the backup is created in my downloads file.

    To recover the back up files, I selected import from the downloads files and chose the file created. Format is SQL and then I selected Import.

    I then see: Error

    SQL query: Copy

    -- Database: db-bfsn-info

    -- Table structure for table wp_commentmeta
    CREATE TABLE wp_commentmeta (
    meta_id bigint(20) UNSIGNED NOT NULL,
    comment_id bigint(20) UNSIGNED NOT NULL DEFAULT 0,
    meta_key varchar(255) DEFAULT NULL,
    meta_value longtext DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

    MySQL said: #1046 - No database selected

    Can anyone advise me where I may be going wrong please,

    Many thanks John

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hey @johnhardy,

    It looks like the error you’re encountering is related to a missing database selection during the import process in phpMyAdmin. The error message #1046 - No database selected indicates that MySQL doesn’t know which database to apply the SQL commands to when trying to import the backup file.

    Ensure you have a database selected: Before importing the SQL file, you need to make sure that you have selected the correct database in phpMyAdmin. Here’s how:

    • Log in to phpMyAdmin.
    • In the left sidebar, you should see a list of databases.
    • Click on the database you want to import the backup into (in your case it looks like db-bfsn-info).
    • Once selected, the database should appear in the top-left corner of the screen.

    If the USE line is missing, add it right after the CREATE DATABASE line (if that line exists) you can add/run the following code.

    CREATE DATABASE IF NOT EXISTS 'db-bfsn-info';
    USE 'db-bfsn-info';

    Import the file again: After ensuring the correct database is selected or the USE line is in place in the SQL file, try the import process again.

    Thread Starter johnhardy

    (@johnhardy)

    Thanks very much for the information.
    When a db backup is being created “Exported” is it OK for this to be Exported to c:/Users/name/Downloads/ ?

    Regards

    John H

    Hey @johnhardy ,

    Yes, it’s absolutely fine for your database backup (export) to be saved to C:/Users/name/Downloads/ that’s just your local machine’s file location. phpMyAdmin doesn’t mind where the file is saved, as long as you can access it when you’re ready to import it again. Just make sure you keep that file safe.

    Regards,
    Lakshyajeet

    Thread Starter johnhardy

    (@johnhardy)

    Many thanks for the information. It is very helpful!

    Regards

    John H

    You’re very welcome, John. I’m glad I could help. If you have any more questions or need further assistance, feel free to reach out.

    Best regards,
    Lakshyajeet

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Backup of localhost/phpmyadmin’ is closed to new replies.