Create a MySQL Database From the Shell

Create a database: (Creates directory /var/lib/mysql/databasename)

[prompt]$ mysqladmin -h localhost -u root -ppassword create databasename

(or use SQL command: CREATE DATABASE bedrock;)

Add tables, data, etc:
Connect to database and issue the following SQL commands:

[prompt]$ mysql -h localhost -u root -ppassword

mysql> use databasename; – Define database to connect to. Refers to directory path: /var/lib/mysql/databasename
mysql> create table employee (Name char(20),Dept char(20),jobTitle char(20));
mysql> DESCRIBE employee; – View the table just created. Same as “show columns from employee;”

mysql> show tables;

Related Posts:

  • No Related Posts


Online 24X7 Chat Support
 
 
Telephone
Toll Free
Online chat
 
Online 24X7 Email Support
 
Emails
 
 
 
Support
Support email
sales
Sales email
 
Billing
Billing email
 
   
Latest Tutorials & Articles (Updated Daily)
http://blog.eukhost.com
  Forums :
http://www.eukhost.com/forums/