A script to test MySQL port is running

62 记录 Leave a Comment
#!/bin/bash ip="<MySQL HOST>" port="<MySQL PORT>" output_file="<Log File Path>" while : do nc -zv "$ip" "$port" > /dev/null datetime=$(date +"%Y-%m-%d %H:%M:%S") if [ $? -eq 0 ]; then echo "$datetime: Port $port is open on $ip…

MySQL REGEXP_REPLACE() function

449 Uncategorized Leave a Comment
Notice: Corrently, REGEXP_REPLACE() do not support \s. Here is an example of using MySQL 8+ regexp_replace(): > select regexp_replace('<div>Hello <b>world</b></div>', '<b>.*?</b>', 'MySQL', 1, 0, 'in') as result; +---------------------…

Quick start docker containers in one command

500 记录 Leave a Comment
If you want start container as daemon, just add argument -d to the command If you want the container has a name, add argument --name <Container Name> MySQL Quick start MySQL from Docker, ~ docker run --rm -p 3306:3306 -e MYSQL_ROOT_PASSWORD=12345678 mysql The login info will be username: root password: 1…