mirror of
https://github.com/bitnami/containers.git
synced 2026-10-19 05:02:27 +02:00
Fix my.cnf for mysql client, simplify mysql client command
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
## Usage
|
||||
|
||||
### Running a mysql server
|
||||
### Running a MySQL server
|
||||
```
|
||||
docker run --name mysql-server \
|
||||
-v /my-data:/data \
|
||||
@@ -10,11 +10,9 @@ docker run --name mysql-server \
|
||||
-d bitnami/mariadb
|
||||
```
|
||||
|
||||
### Running the mysql client
|
||||
### Running the MySQL client
|
||||
```
|
||||
docker run --link mysql-server:mysql bitnami/mariadb \
|
||||
sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" \
|
||||
-uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'
|
||||
docker run -it --link mysql-server:mysql bitnami/mariadb mysql -h mysql -P 3306 -u root -p
|
||||
```
|
||||
|
||||
## Persistence
|
||||
|
||||
@@ -6,16 +6,15 @@ if [ "${1:0:1}" = '-' ]; then
|
||||
set -- mysqld.bin
|
||||
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
|
||||
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 [ -z "$MYSQL_PASSWORD" ]; then
|
||||
MYSQL_PASSWORD=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12)
|
||||
|
||||
Reference in New Issue
Block a user