How does wordpress automatically create a database on installation?

I have just begun using a live server for testing my php scripts and I am aware of how you can automatically create a table with the IF NOT EXISTS query. But how does one create a database automatically? I have had to manually select a db name and password on my host and I am now wondering as to how WP does it all automatically.

Does anybody know the mechanism behind that?

If it does that’s news to me.

AFAIK WordPress can create the tables, but the database has to be there.

Where did you see otherwise?

1 Like

Well, I have it installed on the xampp server. All I had to do was copy paste the wordpress install in the htdocs folder. Are you suggesting that one has to manually create databases on a live server even for wordpress?

You didn’t need to have a database first?

More than suggesting it’s been a while since I switched hosts, but for the 3 I’ve had WordPress on I needed to create databases first, yes.

And more than only WordPress, for other CMSs and Forums I’ve tried out, the same thing, I needed the database first.

If things have changed I’m interested to know what’s involved myself.

Nothing has changed. WordPress has simplified the installation process a lot, but it still asks for your database name on the opening page of the installation. All it will do is build the database tables once you point t to the correct database.

There seems like a disconnect between your question’s intent and the answers you’re getting.

WP doesn’t “automatically create a database”. You either need to create one using the MySQL tools on your server (or through your host’s control panel/tool), or use the one-click install procedure from your host assuming there is one.

(BTW: Please do not use one-click installs; what you get is less than clean/standard)

I presume what you are actually asking, though, is how WP creates the 11 WP tables that a clean and new WP install includes? And the answer to that is that WP’s install procedure includes a script that runs the MySQL commands that make them (“create tablename”) using the prefix you specify (default is “wp_”)

Helpful?

Jeff Yablon

Yes, thank you. I haven’t really used wordpress in a long time (if at all) and was under the impression that the databases were created automatically. I watched some of the tutorial videos on youtube and everything you and the others specify in your comments amounts to true. Thanks for your time.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.