Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8816143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:32:57+00:00 2026-06-14T04:32:57+00:00

All I want to do is create a new database off of a dump

  • 0

All I want to do is create a new database off of a dump created by phpmyadmin.
This dump is located in : /var/www/iadmin/wikifresh/db/template.sql and won’t ever change.

I ran this command once, and the database was created fine

mysql test < /var/www/iadmin/wikifresh/db/template.sql

and it created the database. So, I put that script inside of a php exec command:
(note: $wikiname is the name of the new wiki being created)

$dbwikiname = escapeshellarg($wikiname);
exec("mysql $dbwikiname < /var/www/iadmin/wikifresh/db/template.sql");

now, when this script runs, I get:

ERROR 1049 (42000): Unknown database 'test'

even if I try to run it from my command line I have this issue.

what am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T04:32:58+00:00Added an answer on June 14, 2026 at 4:32 am

    For mysql to be invoked with a default database name, the database must exist.

    Some distributions of MySQL happen to ship with a database called test, which explains why your command succeeded at first. One presumes you have since dropped that database? You will need to recreate it before attempting to select it:

    CREATE DATABASE IF NOT EXISTS test;
    

    Of course, you could instead place the above command, followed by USE test; atop your template.sql file and then invoke mysql without specifying a default database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create one new model class, which will be extended in all
I want to create the dictionary of all the ViewModels. public static Dictionary<string, WeakReference>
I want to create a wrapper class so that all queries should not be
I want to create a string in JavaScript that contains all ascii characters. How
I want to create a logger which logs all my messages sent to System.out
i want to create a simple state machine using C but all the events
I want to create JSF table which has select all button and check box
I want to create an Android app that can be used on 2.3.3 all
I want to create and then destroy buttons, all with code, but can't find
I want to create a Pong game with a moving ball and all the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.