productsupcom/ansible-dyninv-mysql

How to initially fill mysql tables?

Closed this issue · 1 comments

Do you have any advice, how to initially import data from yml files to mysql tables?

With a privileged user in the database server (root?) and after replacing my_database_name, my_user and my_password (and maybe localhost if the database is not hosted in the same computer) do:
mysql -e "CREATE DATABASE IF NOT EXISTS my_database_name"
mysql -e "CREATE USER 'my_user'@'localhost' IDENTIFIED BY 'my_password'"
mysql -e "GRANT ALL ON my_database_name.* TO 'my_user'@'localhost'"
mysql my_database_name < tables.sql