MySQL
To use MySQL, download the package from
http://www.mysql.org and install
it. I’ve got a mysql
user with
access to the scripts, and the /usr/local/mysql/bin
directory in that
user’s path. I’ve also set my root
MySQL user’s password to a non-empty password; you
should do this too, with the command mysqladmin
-u
root
password
[new password]
. You
can then create the Forethought database with the following command:
[localhost:~] mysql% mysqladmin -u root -p create forethought Enter password:
You won’t get any visible output, but
don’t be concerned; this does create the database.
You’re now ready to connect to the database and run
the SQL scripts. Use the mysql
command for this,
as shown:
[localhost:~] mysql% mysql -u root -p forethought Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 16 to server version: 3.23.37 Type 'help;' or '\h' for help. Type '\c' to clear the buffer mysql> source database_schema_users.sql Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.01 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 1 row affected (0.01 sec) mysql> source database_schema_accounts.sql Query OK, 0 rows affected (0.01 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.01 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.01 sec) mysql> exit Bye
In the same manner, you can use the source
command to execute the keys script, the data types script, and the script that drops tables. ...
Get Building Java Enterprise Applications now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.