JackTheRussel
Programmer
Hi all.
I have backup script which backup my database in every day.
And its works perfectly.
Now I would like to increase security and I wrote username and password information in file named security.ini
it locates in address /home/user/security.ini
seurity.ini
How my script can read these informations ? I try like this, but
its not working.
I just get error: Got error: 1045: Access denied for user '{DATABASE}'@'localhost' (using password: YES) when trying to connect
I have backup script which backup my database in every day.
Code:
#!/bin/sh
datetime=`date '+%y-%m-%d-%H-%M-%S'`
mysqldump -u root -pPassword database | gzip > /home/user/backups/backup-$datetime.sql.gz
And its works perfectly.
Now I would like to increase security and I wrote username and password information in file named security.ini
it locates in address /home/user/security.ini
seurity.ini
Code:
[DATABASE]
db_host= localhost
db_name=database
db_username=root
db_password=Password
How my script can read these informations ? I try like this, but
its not working.
Code:
#!/bin/sh
$security=`'/home/user/security.ini'`;
datetime=`date '+%y-%m-%d-%H-%M-%S'`
mysqldump -u $security{'DATABASE'}{'db_username'} -p$security{'DATABASE'}{'password'} database | gzip > /home/user/backups/backup-$datetime.sql.gz
I just get error: Got error: 1045: Access denied for user '{DATABASE}'@'localhost' (using password: YES) when trying to connect