-
Notifications
You must be signed in to change notification settings - Fork 4
Starting MySQL server
Preston Parry edited this page Feb 16, 2015
·
6 revisions
-
which mysqlorbrew install mysql mysql.server stopmysql.server start-
mysql -u rootlogs in as the root user. adding in the-pflag will prompt for a password. create database dbname- In Bash (not the mysql terminal), load your schema using
mysql -u root dbname < server/schema.sqlon the command line. again, the -u root part sets your username to root - log into command line with mysql -u root
7a.
show databases use dbname-
create tablestatement with the full table description describe table- check to see if you have any sql 'modes' enabled:
SELECT @@SESSION.sql_mode; - if so, run
SET SESSION sql_mode = ''; - load the data:
load data infile '~/ghLocal/thesis-project/githubViz/201412export1.csv' into table raw_data_import character set latin1 fields terminated by ',' enclosed by '"' escaped by '\\' lines terminated by '\n' starting by '' ignore 1 lines;for more information on loading data: http://www.mysqltutorial.org/import-csv-file-mysql-table/ - If it's saying 0 rows affected, see what your newline characters are. Excel sometimes adds in an extra comma at the end of each line, at which point your newline character is
',\n'. - if you get warnings,
show warnings; - cackle gleefully! then figure out what you've screwed up :)
- you may have lines in there from before when you were testing; if so:
drop table tablename, and start again at step XX where we create the table.
For more information on the whole process: http://www.linux.org/threads/databases-with-linux.4222/