Right I gave up on this for a while as I was plannign on upgrading to ubuntu 12.04 LTS and though it best to test it there.
Still getting the same problem but after some experimenting I have found its the . in a database name that it does not like.
This works
Code:
#!/bin/bash
domainname=testcouk
username="testuser"
password="testuser"
mysql -u root -ppassword mysql -e "CREATE USER '$username'@'localhost' IDENTIFIED BY '$password';"
mysql -u root -ppassword mysql -e "CREATE DATABASE $domainname;"
mysql -u root -ppassword mysql -e "GRANT ALL PRIVILEGES ON $domainname.* TO $username@localhost;"
but this does not
Code:
#!/bin/bash
domainname=test.co.uk
username="testuser2"
password="testuser2"
mysql -u root -ppassword mysql -e "CREATE USER '$username'@'localhost' IDENTIFIED BY '$password';"
mysql -u root -ppassword mysql -e "CREATE DATABASE $domainname;"
mysql -u root -ppassword mysql -e "GRANT ALL PRIVILEGES ON $domainname.* TO $username@localhost;"
I don't see what it has against the . as I can create the database with this name using phpmyadmin.
Any ideas
Bookmarks