answersLogoWhite

0

How do you create a MySQL database on the server?

Updated: 8/19/2019
User Avatar

Wiki User

12y ago

Best Answer

Here is how you establish connection to mysql server & create a database in mysql

<?php

// Note that username, client host & passwords may vary

$host = "localhost";

$user = "root";

$password = "";

$con = mysql_connect($host,$user,$password);

if(!$con)

{

// Warns for connection failure

die("Failure in establishing connection: ".mysql_error());

}

$db = "CREATE DATABASE employees"; // Use any name for database

$create = mysql_query($db, $con);

if(!$create)

{

echo "Error creating database: ".mysql_error();

}

?>

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you create a MySQL database on the server?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you create a database using PHP?

The following are the fundamental procedures for creating a MySQL database with PHP: As demonstrated in this article, connect to the MySQL server from your PHP script. If the connection is successful, construct a database using SQL and save it in a string variable. Carry out the query. To learn more about data science please visit- Learnbay.co


How do you create a new database in MySQL?

The MySQL command is "CREATE DATABASE [dbname]" with "[dbname]" replaced with your desired database name.


What database does the WAmmp server refer to when it's used with PHP?

WAMP is an abbreviation of "Windows, Apache, MySQL, and PHP", so it uses MySQL database server.


What database does the WAMP server refer to when it?

WAMP stands for Windows Apache Mysql PHP. Mysql is the default database in WAMP


What does the acronym MySQL mean?

MySQL, while not an acronym, is a free SQL database server. The SQL stands for Structured Query Language. This database server runs on Windows, Linux, and Solaris machines.


Is MySQL a server?

MySQL is an open source relational database management system based on SQL queries. It was developed by the Swedish company MySQL AB and is now a subsidiary of Oracle Corporation. Your could use a MySQL Client, for example dbForge Studio for MySQL, to install and connect to MySQL Server as a first steps to get started with MySQL.


How do you connect C offline application with the MySQL database placed at remote server?

We use an online MySQL database for both online and offline applications.


What host do you use when your MySQL database is on a separate server to your PHP scripts?

For the host you need to put the IP address of the MySQL server instead of localhost.


What types of database programs are there?

MS Access, MySQL, SQL Server,


How do you create data base?

You use the appropriate tools from your database's system or third-party tools. For MySQL, you can use PhpMyAdmin to create a database. For Oracle, or Microsoft SQL Server, or other applications, they have tools for this purpose.


How do you copy a database of mysql in wamp server from one computer to another?

You have several options: * copy the database files from mysql/data/&lt;database_name&gt; to a new mysql Installation * use mysqldump utility to export the data from your database and load it into the new mysql installation * setup replication


I have installed MySql server and SQL Maestro for MySql.If i create a new database in mysql maestroit gives Sql access denied for rootlocalhost passwordno.how do i make a connection bween that.?

connect it using a cable line