PDA

View Full Version : Commands to Create a MySQL DB?


EclectiXXX
08-29-2003, 10:56 AM
|waves| Oh Cleo.... and anyone else....

One of the threads we lost was the one discussing how to create a MySQL DB from the UNIX prompt.....

Dr Bizzaro
08-29-2003, 11:24 AM
This one worked for Moses:

"I COMMAND THEE TO BE A MYSQL DATABASE AND THY MUST WORK PROPERLY AND BE TRUE"!.

EclectiXXX
08-29-2003, 11:43 AM
LOL but then the damn thing went and spawned a bunch of golden tables profaning the name of it's Root creator and was almost deleted!!!

Dr Bizzaro
08-29-2003, 12:04 PM
Originally posted by EclectiXXX
LOL but then the damn thing went and spawned a bunch of golden tables profaning the name of it's Root creator and was almost deleted!!!


|buddy| "ABORT! ABORT!"

Cleo
08-29-2003, 02:25 PM
Originally posted by EclectiXXX
|waves| One of the threads we lost was the one discussing how to create a MySQL DB from the UNIX prompt.....

Damn if I know, all the hosts that I have ever had it was done through the control panel so I never had to learn how to do it from a shell.

man mysql

That should point you in the right direction. :)

Also I did a fast search on Google and found this
http://perl.about.com/library/weekly/aa020601a.htm

nickk
08-31-2003, 04:17 PM
doh, thought you said how to create a table,
to create a db just type 'CREATE DATABASE [dbname]' once you logged into mysql.

to create a table:

you have to login to mysql first:
mysql -u [username] -p
it'll ask your for your pass
then, type: use [databasename];

then something of this sort to create the database:
CREATE TABLE [table name]
(
ID INT AUTO_INCREMENT,
name VARCHAR(35) NOT NULL,
name2 int,
name3 date,
name4 text,

PRIMARY KEY (ID)
);

where name,name2... are variables of your choice, and int,date,varchar,text are variable types.

venturi
09-07-2003, 07:54 AM
Almost right there Nickk. :D

first log into mySQL as Nickk said. But do not do the "use" command yet.

type: create database <databasename> \g
type: use <databasename> \g
type: grant all on <databasename> for <youruser> \g

Then you can add tables, etc.
You may have to have root access in order to do the above, depending upon your account settings with your host.