phpMyadmin scripting

Is there a way to write a canned script for phpMyadmin (or MySQL itself) that can run under XAAMP to automatically build a database & import content from .sql files?

I need this capability since I need a simple way for non tech types to install a database from components on a CD or USB drive. I realize it's a piece of cake using phpMyadmin (I do it myself all the time).

I anticipate doing this in a Windows environment using XAAMP as web server software.

Thanks
Richard KortsAsked:
Who is Participating?
 
Julian HansenCommented:
Why not put your DB create in a script and then either load and execute it with PHP or use mysql command line tool
mysql -h SERVER -u USER --password=PASSWORD DATABASE < your_sql_install_script.sql

Open in new window

0
 
Dave BaldwinFixer of ProblemsCommented:
phpMyAdmin is just another PHP program.  Just create a PHP Application that does what you want.
0
 
Richard KortsAuthor Commented:
Dave,

That sounds fine.

But every example I see assumes a "connect" with a user name & password BEFORE the database.

As far as I know, the mysqli_query function requires two arguments, a query & a link. If the link does not yet exist, how do I do this.

Seems like chicken and egg question.

Thanks
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
Julian HansenCommented:
You have to have a name and password to access the DB in order to create any objects in it.

The credentials connect you to the server - after which you have to select the database you want to use.

You setup your connection with a username and password with rights to create tables etc - once that is established you can then issue your commands to create the DB objects.
0
 
Dave BaldwinFixer of ProblemsCommented:
The differences on the command line is that the output does not go to a browser and it is not running on a server.  So any functions that would use them won't work.  See my demo code in this question from yesterday: http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/Q_28672632.html  JulianH is correct, you do have to have the credentials.  But that is the same as on a web site too.
0
 
Richard KortsAuthor Commented:
" JulianH is correct, you do have to have the credentials.  But that is the same as on a web site too. "

I don't follow how I do this. Are you saying there is a user name & password associated with the XAAMP server?

It seems to me that I can't create a database without a user name & password, is that user name & password for MySQL? How do I know / get that? XAAMP comes with MySQL set up.
0
 
Richard KortsAuthor Commented:
OK, this has gotten way off on tangents, I will start over with an EXACT, specific question.

Look for it, under php & MySQL

Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.