This article shares with you the requirements of the security application MySQL for self-starting configuration. We all know that MySQL is favored by many people because of its open-source and practical features, of course, you must make full use of its features only when it is correctly and securely applied. The following articles describe its correct usage.
Note that a new account is required for the PHP database, and the database permission settings are available for the database, for example, FILE, GRANT, ACTER, show database, RELOAD, SHUTDOWN, PROCESS, and SUPER.
Example of self-starting script:
- #!/bin/sh
- CHROOT_MYSQL=/chroot/mysql
- SOCKET=/tmp/mysql.sock
- MYSQLD=/usr/local/mysql/libexec/mysqld
- PIDFILE=/usr/local/mysql/var/`hostname`.pid
- CHROOTUID=/usr/bin/chrootuid
- echo -n " mysql"
- case "$1" in
- start)
- rm -rf ${SOCKET}
- nohup ${CHROOTUID} ${CHROOT_MYSQL} mysql ${MYSQLD} >/dev/null 2>&1 &
- sleep 5 && ln ${CHROOT_MYSQL}/${SOCKET} ${SOCKET}
- ;;
- stop)
- kill `cat ${CHROOT_MYSQL}/${PIDFILE}`
- rm -rf ${CHROOT_MYSQL}/${SOCKET}
- ;;
- *)
- echo ""
- echo "Usage: `basename $0` {start|stop}" >&2
- exit 64
- ;;
- esac
- exit 0
The security application MySQL requires that the file of the self-starting configuration be located in/etc/rc. d/init. d, named mysqld. Be sure to execute it.
- #chmod +x /etc/rc.d/init.d/mysqld
- #ln -s /etc/rc.d/init.d/mysql /etc/rc3.d/S90mysql
- #ln -s /etc/rc.d/init.d/mysql /etc/rc0.d/K20mysql
Although we cannot achieve 100% of the security, these measures can protect our system more securely.
The above content is an introduction to the requirements of the security application MySQL for self-starting configuration. I hope you will gain some benefits.