#MySQL Practice Arena This doc will server as a living cheatsheat / knowledge repo for my MySQL adventures.
####Ways to import a file into MySql via the command line:
sql mysql database_name < file.sql
That assumes you have created the database already and you dont have to use the -u -p flags at the cli for specifying username and password to MySQL- Alternitively you can create a database, then upload a tab delimited txt file that will import the data for you as shown here. All you do is use the
mysqlimport
command. - Lastly you can use the
source
command to load in data from a file. The steps to this are (1) create the db. (2) Change to that db. (3) source somedatabasetable.sql and poof youre done.
####Inspecting the lay of the MySQL land:
Seeing which databases are out there: Just run show databases;
. Alternitively to see which tables are out there you can run show tables;
.
Once you see what databases you have you can select a db to work with by typing use dbname
. Then to see what a particular table structure looks like you can type ```` describe tablename `````.