Fix my.cnf for mysql client, simplify mysql client command

This commit is contained in:
Adnan Abdulhussein
2015-05-20 18:42:13 -07:00
parent d5f2a83d46
commit 3a9f0115c6
2 changed files with 8 additions and 11 deletions

View File

@@ -2,7 +2,7 @@
## Usage ## Usage
### Running a mysql server ### Running a MySQL server
``` ```
docker run --name mysql-server \ docker run --name mysql-server \
-v /my-data:/data \ -v /my-data:/data \
@@ -10,11 +10,9 @@ docker run --name mysql-server \
-d bitnami/mariadb -d bitnami/mariadb
``` ```
### Running the mysql client ### Running the MySQL client
``` ```
docker run --link mysql-server:mysql bitnami/mariadb \ docker run -it --link mysql-server:mysql bitnami/mariadb mysql -h mysql -P 3306 -u root -p
sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" \
-uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'
``` ```
## Persistence ## Persistence

View File

@@ -6,16 +6,15 @@ if [ "${1:0:1}" = '-' ]; then
set -- mysqld.bin set -- mysqld.bin
fi fi
if [ ! "$(ls -A /conf)" ]; then
echo "Copying default configuration to /conf/my.cnf..."
echo ""
cp -r /opt/bitnami/mysql/conf.defaults/* /opt/bitnami/mysql/conf
fi
if [ "$1" = 'mysqld.bin' ]; then if [ "$1" = 'mysqld.bin' ]; then
set -- "$@" --defaults-file=/opt/bitnami/mysql/my.cnf --log-error=/opt/bitnami/mysql/logs/mysqld.log --basedir=/opt/bitnami/mysql --datadir=/opt/bitnami/mysql/data --plugin-dir=/opt/bitnami/mysql/lib/plugin --user=mysql --socket=/opt/bitnami/mysql/tmp/mysql.sock$EXTRA_OPTIONS set -- "$@" --defaults-file=/opt/bitnami/mysql/my.cnf --log-error=/opt/bitnami/mysql/logs/mysqld.log --basedir=/opt/bitnami/mysql --datadir=/opt/bitnami/mysql/data --plugin-dir=/opt/bitnami/mysql/lib/plugin --user=mysql --socket=/opt/bitnami/mysql/tmp/mysql.sock$EXTRA_OPTIONS
if [ ! "$(ls -A /conf)" ]; then
echo "Copying default configuration to /conf/my.cnf..."
echo ""
cp -r /opt/bitnami/mysql/conf.defaults/* /opt/bitnami/mysql/conf
fi
if [ ! "$(ls -A /data)" ]; then if [ ! "$(ls -A /data)" ]; then
if [ -z "$MYSQL_PASSWORD" ]; then if [ -z "$MYSQL_PASSWORD" ]; then
MYSQL_PASSWORD=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12) MYSQL_PASSWORD=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12)