| ID | FIRST_NAME | LAST_NAME | DEPARTMENT | We can now inspect the table by running an SQL query: $ mysql -user=sysadmin -password=mypassword -e 'SELECT * FROM EmployeeDB.employees ' Importantly, another approach is to save the password in a Bash variable and subsequently access it through parameter expansion, so that it isn’t exposed on the command line. The –user option of the mysql command specifies the user, while the –password switch specifies the user password.
Next, we run the code by supplying the SQL file to the mysql command via stdin: $ mysql -user=sysadmin -password=mypassword < create_db.sql The table has four columns, and three records are already in it. In this case, the database name is EmployeeDB and the table within it is called employees.
INSERT INTO employees VALUES ('3','Mat','Ray','Finance')
INSERT INTO employees VALUES ('2','Ron','Lee','IT') INSERT INTO employees VALUES ('1','Lin','Day','HR')