mirror of
https://github.com/weewx/weewx.git
synced 2026-04-20 09:37:02 -04:00
48 lines
2.3 KiB
Plaintext
Executable File
48 lines
2.3 KiB
Plaintext
Executable File
#/bin/bash
|
|
#
|
|
# Shell script to set up the MySQL database for testing
|
|
#
|
|
# It creates three users:
|
|
#
|
|
# 1. User: weewx
|
|
# Password: weewx
|
|
# 2. User: weewx1
|
|
# Password: weewx1
|
|
# 3. User: weewx2
|
|
# Password: weewx2
|
|
#
|
|
# NB: user weewx2 has more restrictive permissions than user weewx1
|
|
#
|
|
echo "You may get an error 'Operation DROP USER failed' when running this script."
|
|
echo "This can be safely ignored."
|
|
echo "Give the root password when prompted->"
|
|
mysql --force -u root -p << EOF
|
|
drop user 'weewx'@'localhost';
|
|
drop user 'weewx1'@'localhost';
|
|
drop user 'weewx2'@'localhost';
|
|
create user 'weewx'@'localhost' identified by 'weewx';
|
|
create user 'weewx1'@'localhost' identified by 'weewx1';
|
|
create user 'weewx2'@'localhost' identified by 'weewx2';
|
|
grant select, update, create, delete, drop, insert on test.* to 'weewx'@'localhost';
|
|
grant select, update, create, delete, drop, insert on test_alt_weewx.* to 'weewx'@'localhost';
|
|
grant select, update, create, delete, drop, insert on test_alt_weewx.* to 'weewx1'@'localhost';
|
|
grant select, update, create, delete, drop, insert on test_scratch.* to 'weewx'@'localhost';
|
|
grant select, update, create, delete, drop, insert on test_sim.* to 'weewx'@'localhost';
|
|
grant select, update, create, delete, drop, insert on test_sim.* to 'weewx1'@'localhost';
|
|
grant select, update, create, delete, drop, insert on test_weedb.* to 'weewx'@'localhost';
|
|
grant select, update, create, delete, drop, insert on test_weedb.* to 'weewx1'@'localhost';
|
|
grant select, update, create, delete, drop, insert on test_weewx.* to 'weewx'@'localhost';
|
|
grant select, update, create, delete, drop, insert on test_weewx.* to 'weewx1'@'localhost';
|
|
grant select, update, create, delete, drop, insert on test_weewx1.* to 'weewx'@'localhost';
|
|
grant select, update, create, delete, drop, insert on test_weewx2.* to 'weewx'@'localhost';
|
|
grant select, update, create, delete, drop, insert on test_weewx1.* to 'weewx1'@'localhost';
|
|
grant select, update, create, delete, drop, insert on test_weewx2.* to 'weewx1'@'localhost';
|
|
grant select, update, create, delete, drop, insert on test_weewx2.* to 'weewx2'@'localhost';
|
|
grant select, update, create, delete, drop, insert on weewx.* to 'weewx'@'localhost';
|
|
EOF
|
|
if [ $? -eq 0 ]; then
|
|
echo "Finished setting up MySQL."
|
|
else
|
|
echo "Problems setting up MySQL"
|
|
fi
|