Import a mysql database into OS X 10.8
I have found that phpmydmin on the Mac has issues with the max upload file size limit and changing the value in php.ini doesn’t always do the trick. Since mysql is already installed a quick trip to the terminal will sort this out.
Create the database if it isn’t already:
mysql -u [username] -p -e "create database [databasename];"
When prompted enter a password or enter one in the command – change -p to -p [password]).
Now navigate to the directory where the sql file is located and import the mysql file:
mysql -u[username] -p [databasename] < [.sql filename]
Thats all there is to it !
You can also connect with mysql interactively and create new databases after log in, but the import method still needs to applied as above:
mysql -u [username] -p[password]
So after log in at the prompt, create the new database, ensure your command is ended with a “;”
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1935 Server version: 5.5.13 MySQL Community Server (GPL) Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database databasename;