Skip to content

Instantly share code, notes, and snippets.

@robertbindar
Last active November 17, 2021 12:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertbindar/831c1aadfa22991db22f50675415956e to your computer and use it in GitHub Desktop.
Save robertbindar/831c1aadfa22991db22f50675415956e to your computer and use it in GitHub Desktop.
Setup script for mariadb_kernel in TLJH
#!/bin/bash
port=3306
for dir in /home/*;
do
echo $dir
rm -rf $dir/datadir $dir/.jupyter/mariadb_config.json $dir/.my.cnf
username=`echo $dir | cut -d'/' -f3`
sudo -u $username mkdir -p $dir/.jupyter
sudo -u $username echo "
{
\"user\": \"root\",
\"host\": \"localhost\",
\"port\": \"$port\",
\"password\": \"\",
\"start_server\": \"True\",
\"client_bin\": \"mysql\",
\"server_bin\": \"mysqld\",
\"db_init_bin\": \"mysql_install_db\",
\"server_datadir\": \"$dir/datadir\",
\"socket\": \"$dir/mysqld-dbg.sock\",
\"server_pid\": \"$dir/mysqld.pid\"
}" > $dir/.jupyter/mariadb_config.json
port=$((port + 1))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment