BLOG HOME -  UK WEB HOSTING -  PHP MYSQL HOSTING -  RESELLER HOSTING -  eUKhost FORUMS -  VPS HOSTING

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;

digg this


This post is compiled by eUKhost.com

Leave a Comment

You must be logged in to post a comment.