deadimp Posted September 2, 2007 Share Posted September 2, 2007 Is there a quick way to execute a set of statements delimited by a ';'? I'm using this to restore the database for my CMs as a CRON task... The file is an SQL dump generated by SQLyog. Link to comment https://forums.phpfreaks.com/topic/67621-execute-multiple-statements-in-one-query-for-execute-sql-file/ Share on other sites More sharing options...
Barand Posted September 3, 2007 Share Posted September 3, 2007 mysqli (PHP5) can execute multiple statements Link to comment https://forums.phpfreaks.com/topic/67621-execute-multiple-statements-in-one-query-for-execute-sql-file/#findComment-340921 Share on other sites More sharing options...
deadimp Posted September 3, 2007 Author Share Posted September 3, 2007 Is there a way to have mysqli act off of a normal mysql link? I'm looking for a way, but I haven't found it yet. Link to comment https://forums.phpfreaks.com/topic/67621-execute-multiple-statements-in-one-query-for-execute-sql-file/#findComment-340925 Share on other sites More sharing options...
Barand Posted September 3, 2007 Share Posted September 3, 2007 also, from mysql manual [pre] 4.9.13 How to Run SQL Commands from a Text File The mysql client typically is used interactively, like this: shell> mysql database However, it's also possible to put your SQL commands in a file and tell mysql to read its input from that file. To do so, create a text file `text_file' that contains the commands you wish to execute. Then invoke mysql as shown here: shell> mysql database < text_file You can also start your text file with a USE db_name statement. In this case, it is unnecessary to specify the database name on the command line: shell> mysql < text_file If you are already running mysql, you can execute an SQL script file using the source command: mysql> source filename; For more information about batch mode, section 3.5 Using mysql in Batch Mode. Link to comment https://forums.phpfreaks.com/topic/67621-execute-multiple-statements-in-one-query-for-execute-sql-file/#findComment-340928 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.