<== Back
Starting SQL
1. Minimize the command prompt and open up a new one.
2. in your directory type "mysql -u root" and hit enter
At this point you will see:
----------------------------------------------------------------------------------------
Welcome (etc...)
mysql>
----------------------------------------------------------------------------------------
When you see the "mysql>" prompt instead of the C:\> prompt, it means the client is ready for you
to start typing sql.
you can type in "show datases;" to see which databases you have. This will list all of the databases
that were installed when you downloaded and installed MySQL.
the mysql database stores internal data of the DBMS. Don't screw with this or you'll screw yourself.
the test database is created for you to mess with. You can create more, but at this point this is
what you've got. Now lets go inside...
Going Inside
Enter "use mysql;"
It will return "Database changed" to let you know it worked.
Enter "show tables;"
It will show you all of the tables in that DB.
Lets look inside one of these tables:
select * from user;
Wow, that's ugly. Try adding a "\G"
select * from user\G;
This shows the row in a vertical format. (sort of making the columns into rows and the rows into
columns)
Now lets switch to a diferent database, let's switch to "test"
use test;
It switches...
show tables;
Returns "Empty set" this means there is nothing in it...
To get out of there just say "quit"
<== Back