| 121 | |
| 122 | == mysql example == |
| 123 | |
| 124 | Author: Patrick Ruckstuhl |
| 125 | |
| 126 | I had some time ago to continue with putting my configuration into |
| 127 | bcfg2 and maybe this helps someone else. |
| 128 | |
| 129 | I added a new bundle: |
| 130 | {{{ |
| 131 | <Bundle name="mysql-server" version="3.0"> |
| 132 | <ConfigFile name="/root/bcfg2-install/mysql/users.sh"/> |
| 133 | <ConfigFile name="/root/bcfg2-install/mysql/users.sql"/> |
| 134 | <PostInstall name="/root/bcfg2-install/mysql/users.sh"/> |
| 135 | <Package name="mysql-server-4.1"/> |
| 136 | <Service name="mysql"/> |
| 137 | </Bundle> |
| 138 | }}} |
| 139 | |
| 140 | The `users.sh` script looks like this: |
| 141 | {{{ |
| 142 | #!/bin/sh |
| 143 | |
| 144 | mysql --defaults-extra-file=/etc/mysql/debian.cnf mysql \ |
| 145 | < /root/bcfg2-install/mysql/users.sql |
| 146 | }}} |
| 147 | |
| 148 | On debian there is a user account in `/etc/mysql/debian.cnf` automatically created, but you could also create such a file yourself, with contents like: |
| 149 | {{{ |
| 150 | [client] |
| 151 | host = localhost |
| 152 | user = debian-sys-maint |
| 153 | password = XXXXXXXXXX |
| 154 | }}} |
| 155 | |
| 156 | The `users.sql` looks like this: |
| 157 | {{{ |
| 158 | DELETE FROM db; |
| 159 | INSERT INTO db VALUES ('localhost', 'phpmyadmin', 'pma', 'Y', 'Y', |
| 160 | 'Y', 'Y', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N'); |
| 161 | |
| 162 | DELETE FROM user WHERE User <> 'debian-sys-maint'; |
| 163 | INSERT INTO user VALUES ('localhost', 'root', 'XXXXXXXXXXX', 'Y', 'Y', |
| 164 | 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', |
| 165 | 'Y', 'Y', 'Y', 'Y', 'Y', '', '', '', '', 0, 0, 0); |
| 166 | INSERT INTO user VALUES ('localhost', 'pma', '', 'N', 'N', 'N', 'N', |
| 167 | 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', |
| 168 | 'N', 'N', 'N', '', '', '', '', 0, 0, 0); |
| 169 | |
| 170 | FLUSH PRIVILEGES; |
| 171 | }}} |