Creating a New Database Using MySql

Provide an outline of creating a new database using mysql.

To create the sample MySQL database:

1. Copy the SQL script file, insert.sql, to an appropriate folder on the computer that has MySQL installed. 

2. If the computer running MySQL is a Windows computer, copy the insert.sql script to MySql\Bin. If the computer running MySQL is a Macintosh, copy the insert.sql script to your Documents folder in your home folder. 

3. On the computer that has MySQL installed, open a command prompt window (Windows) or a Terminal window (Macintosh). 
- In Windows, you can open the command prompt by selecting Start > Programs > Command Prompt or Start > Programs > Accessories > Command Prompt. 
- On the Macintosh, you can open a Terminal window by going to the Applications folder, opening the Utilities folder, and double-clicking Terminal. 

4. (Windows only) Change to the mysql\bin directory by entering the following commands at the command prompt: 

5. cd
 \  cd mysql\bin  

6. Start the MySQL client by entering the following command: 
mysql -uUser -pPassword  
If you didn't define a user name while configuring your MySQL installation, enter root as the user name, as follows:
mysql -uroot  
The MySQL client's command prompt appears, as follows:

7. Create a new database by entering the following command at the MySQL prompt: 
mysql>CREATE DATABASE TrioMotors;  
MySQL creates a new database, but it doesn't contain any tables or records yet.

8. Log out of the MySQL client by entering the following command at the prompt: 
mysql>quit;  mysql -uUser -pPassword TrioMotors < insert.sql  

Have a Oracle Question
Do you have an Oracle Question?

Oracle Books
Oracle Certification, Database Administration, SQL, Application, Programming Reference Books

Oracle Application
Oracle Application Hints and Tips

Oracle Home
Oracle Database, SQL, Application, Programming Tips

All the site contents are Copyright © and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of or the content authors.