#!/bin/sh #---------------------------------------------------------------------------- # /var/install/bin/mariadb-tools-userlist - MariaDB/MySQL Server list user # # Creation: 2004-06-09 jv # Last Update: $Id$ # # Copyright (c) 2004 Jens Vehlhaber, jvehlhaber(at)buchenwald(dot)de # Copyright (c) 2012-@@YEAR@@ Holger Bruenjes, holgerbruenjes(at)gmx(dot)net # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- #include eislib . /var/install/include/eislib # check if use cui version . /etc/config.d/setup # --------------------------------------------------------------------------- # defaults # --------------------------------------------------------------------------- get_defaults() { # default values . /var/lib/mysql/defaults.info } # --------------------------------------------------------------------------- # check status and access of MariaDB/MySQL Database # --------------------------------------------------------------------------- check_status() { if [ ! -f ${mysql_pid_file} ] then echo mecho --error "MariaDB/MySQL Server is not running." echo exit 1 fi ${mysql_basedir}/mysqladmin status >/dev/null 2>&1 if [ "${?}" -ne 0 ] then echo mecho -n --error 'MariaDB/MySQL Server' mecho -n --std " 'root' " mecho --error 'password is required.' mecho --info 'Please set the root password.' echo exit 1 fi } # --------------------------------------------------------------------------- # list user # --------------------------------------------------------------------------- run_list() { # if [ "${MENU}" = "/var/install/bin/show-menu.cui" ] # then # ${base_dir}/list-mysql.cui --title="MariaDB/MySQL user:" \ # --server=unix:${socket} \ # --database=mysql \ # --user=root \ # --query="SELECT user, host, select_priv, insert_priv, grant_priv FROM user" \ # --helpfile=/var/install/help/mariadb \ # --helpname=MARIADB_MENU_USERLIST # exit 0 # fi clrhome mecho --info "List all MariaDB/MySQL user" ${mysql_basedir}/mysql \ -e "use mysql;SELECT user,host,select_priv,insert_priv,grant_priv FROM user;" anykey } # --------------------------------------------------------------------------- # main # --------------------------------------------------------------------------- main() { get_defaults check_status run_list exit 0 } # --------------------------------------------------------------------------- # call function main # --------------------------------------------------------------------------- main "${@}" # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------