Last active
May 4, 2017 21:10
-
-
Save ArsSirek/1b3dea28ddf2cea58243 to your computer and use it in GitHub Desktop.
command line mysql database import from file (like phpmyadmin export)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql -u username -p -h localhost | |
# > in sql command line | |
# Attention!! this will ERASE database from server | |
# Be sure that you know what are you doing | |
DROP DATABASE database_name; | |
CREATE DATABASE database_name; | |
ALTER DATABASE database_name charset=utf8mb4; | |
#create user if needed | |
CREATE USER 'user_name'@'localhost' IDENTIFIED BY 'pwd'; | |
GRANT ALL PRIVILEGES ON database_name.* TO user_name@localhost; | |
# executes sql command from file (import from phpmyadmin defualt export) | |
mysql -u username -p database_name < file.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment