MySQL DBA - Tips and Techniques Magazine

11 Nov 2014

Execute a script file on Mysql using source

Steps to show one of the way (Ie using 'source' command) to execute the script file, which contains the sql statements, on Mysql database

 


Example:

Server name = mk-xx-1

Database: ANYPROV

File name= vmsinserts.txt ( ie ~137 insert statements onto the table USERACCOUNT on ANYPROV database)

 

1 connect onto the server

2 mysql –u{username} –p{password}

3 mysql> show tables;

4 mysql> use ANYPROV

5 mysql> select count(*) from useraccount;

6 mysql> source vmsinserts.txt

7 mysql> select count(*) from useraccount;

No comments:

Post a Comment