Fill these in once
- Create the database if it doesn't exist
mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS myapp;"On Ubuntu, the root user logs in with sudo mysql instead.
- Import the file
mysql -u root -p myapp -e "source backup.sql"
Check it worked
- List the imported tables
mysql -u root -p myapp -e "SHOW TABLES;"
- Create the database if it doesn't exist
mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS myapp;"On Ubuntu, the root user logs in with sudo mysql instead.
- Import the file
mysql -u root -p myapp -e "source backup.sql"
Check it worked
- List the imported tables
mysql -u root -p myapp -e "SHOW TABLES;"
- Create the database if it doesn't exist
mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS myapp;"On Ubuntu, the root user logs in with sudo mysql instead.
- Import the file
mysql -u root -p myapp -e "source backup.sql"
Check it worked
- List the imported tables
mysql -u root -p myapp -e "SHOW TABLES;"