- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1
Execute sql file from terminal
        Zhamri Che Ani edited this page Oct 8, 2025 
        ·
        4 revisions
      
    mysql -u root -p cmsdb < /Users/zhamri/desktop/cms.sqlcmsdb → your target database name
-u root → username
It will prompt for your password, then execute all the SQL statements inside cms.sql.
If your database doesn’t exist yet:
mysql -u root -p -e "CREATE DATABASE cmsdb;"
mysql -u root -p cmsdb < /Users/zhamri/desktop/cms.sqlmysql -u root -pThen inside the MySQL prompt:
USE cmsdb;
SOURCE /Users/zhamri/desktop/cms.sql;💡 Tip: You can check your current path using pwd (in Unix/macOS).