Similar to ordinary scripting languages, MySQL also has a set of rules for the use of characters, words and special symbols. MySQL completes database operations by executing SQL scripts. This script consists of one or more MySQL statements (SQL statement expansion statement), the suffix name of the script file is usually .sql. The MySQL client can also execute statements on the console without saving the statements as a .sql file.
The first method: Enter
mysql -h localhost -u root -p123456 < F:\hello world\niuzi.sql
at the command line (not connected to the database). Note: does not need to be quoted in the path!!
Second method: Under the command line (the database is connected, the prompt at this time is mysql>) Enter the mysql command line and execute another sql statement Check the table Check whether there is data in the table The above is the detailed content of How to execute sql script in mysql. For more information, please follow other related articles on the PHP Chinese website!source E:\sources\RuoYi\sql\quartz.sql
show tables;
select * from sys_role;