Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Call to undefined function: mysql_create_db()

Posted on 2004-08-19
Medium Priority
Last Modified: 2008-01-09
Is it possible to have PHP setup so that it can talk to MySQL?

I'm running a script but getting the error Call to undefined function: mysql_create_db()

Question by:jacobcolton
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 48

Expert Comment

ID: 11839902
is the extension for mysql-compiled in PHP or can it be loaded dynamicly:

if (!extension_loaded('mysql')) {
    if (!dl('')) {
           die('mysql - extension not available');
echo "mysql- available"

for windows ty the line
    if (!dl('php_mysql.dll')) {

If you get the error -message you need to recomplie PHP

Accepted Solution

Boris Aranovich earned 1500 total points
ID: 11840185
It's an old function that is deprecated in new PHP versions, and will not work with MySQL 4.x
You should use mysql_query("CREATE DATABASE ....")

PHP mysql_create_db():

Expert Comment

ID: 11841111
PHP has to be compiled using:

If you need more details, check this URL:

And then do as Nomaed suggested, use:

mysql_query("CREATE DATABASE `namegoeshere`");

Also make sure than mysql username that you are using to connect has enough privileges to create databases.

Expert Comment

ID: 12890548
Have a look at

I plugged a long response about the DLL's for mySQL & PHP in windows

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question