Автоматизация послеустановочной настройки MySQL |
[исправить] |
#!/bin/sh
#
# mysql-after-setup
# Copyright (c) 2006 Alexey Tsvetnov, [email protected]
# Version: 1.4
#
# Run script after install MySQL to do:
# 1. Drop database 'test'
# 2. Set MySQL root password
# 3. Delete all users and access except root@localhost
#
# tty echo off
stty -echo
# enter correct password
while true
do
echo -n "Enter password: " && read pass1 && echo
echo -n "Re-enter password: " && read pass2 && echo
[ "${pass1}" = "${pass2}" ] && break
echo " *** Error!"
done
# tty echo on
stty echo
echo "drop database test; delete from db where db like '%test%';\
update user set password=PASSWORD('$pass1') where user='root' and host='localhost';\
delete from user where password='';\
flush privileges;" | mysql -h 127.0.0.1 -u root mysql && echo "Done successfuly."
exit 0
|
|
|
|
Раздел: Корень / Программисту и web-разработчику / SQL и базы данных / MySQL специфика / Оптимизация и администрирование MySQL |