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 KortsBusiness Owner / Chief DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
phpMyAdmin is just another PHP program.  Just create a PHP Application that does what you want.
0
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Richard KortsBusiness Owner / Chief DeveloperAuthor 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
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

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 KortsBusiness Owner / Chief DeveloperAuthor 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 KortsBusiness Owner / Chief DeveloperAuthor 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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.