[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

set up MySQL Server on solaris box (continued)



 
    
set up MySQL Server on solaris box (continued)
----------------------------------------------

[http@wiske mysql]$ pwd
/servers/web/mysql

[http@wiske mysql]$ scripts/mysql_install_db --basedir=/servers/web/mysql --datadir=/siwc/sgml/www.it-security.unimacq.edu.au/mysql --user=http
Preparing db table
Preparing host table
Preparing user table
Preparing func table
Preparing tables_priv table
Preparing columns_priv table
Installing all prepared tables
051019 16:20:20  ./bin/mysqld: Shutdown Complete


To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
This is done with:
/servers/web/mysql/bin/mysqladmin -u root password 'new-password'
/servers/web/mysql/bin/mysqladmin -u root -h wiske password 'new-password'
See the manual for more instructions.

You can start the MySQL daemon with:
cd . ; /servers/web/mysql/bin/safe_mysqld &

You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; run-all-tests

Please report any problems with the ./bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com

[http@wiske mysql]$ bin/safe_mysqld --basedir=/servers/web/mysql --datadir=/siwc/sgml/www.it-security.unimacq.edu.au/mysql --ledir=/servers/web/mysql/bin --pid-file=/siwc/sgml/www.it-security.unimacq.edu.au/mysql/wiske.pid
Starting mysqld daemon with databases from /siwc/sgml/www.it-security.unimacq.edu.au/mysql
   err_log[/siwc/sgml/www.it-security.unimacq.edu.au/mysql/wiske.err]
   updatelog[/siwc/sgml/www.it-security.unimacq.edu.au/mysql/wiske.updates.log]
   MYSQL_OPTIONS[--log-update=/siwc/sgml/www.it-security.unimacq.edu.au/mysql/wiske.updates.log -O key_buffer=16M -O record_buffer=16M -O sort_buffer=16M -O table_cache=256]
==(1) [nohup /servers/web/mysql/bin/mysqld  --basedir=/servers/web/mysql --datadir=/siwc/sgml/www.it-security.unimacq.edu.au/mysql  --log-update=/siwc/sgml/www.it-security.unimacq.edu.au/mysql/wiske.updates.log -O key_buffer=16M -O record_buffer=16M -O sort_buffer=16M -O table_cache=256 --pid-file=/siwc/sgml/www.it-security.unimacq.edu.au/mysql/wiske.pid  >> /siwc/sgml/www.it-security.unimacq.edu.au/mysql/wiske.err 2>&1]

[http@wiske mysql]$ /servers/web/mysql/bin/mysqladmin -u root password 'getoff'

[http@wiske mysql]$ /servers/web/mysql/bin/mysqladmin -u root -h wiske.its.unimacq.edu.au password 'getoff'
/servers/web/mysql/bin/mysqladmin: connect to server at 'wiske.its.unimacq.edu.au' failed
error: 'Host 'wiske.its.unimacq.edu.au' is not allowed to connect to this MySQL server'

[http@wiske mysql]$ /servers/web/mysql/bin/mysql -h localhost -u root -pgetoff
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5 to server version: 3.23.54-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from user;
+-----------+------+------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+
| Host      | User | Password         | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv |
+-----------+------+------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+
| localhost | root | 21565a181fefda91 | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          |
| wiske     | root |                  | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          |
| localhost |      |                  | N           | N           | N           | N           | N           | N         | N           | N             | N            | N         | N          | N               | N          | N          |
| wiske     |      |                  | N           | N           | N           | N           | N           | N         | N           | N             | N            | N         | N          | N               | N          | N          |
+-----------+------+------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+
4 rows in set (0.00 sec)

mysql> insert into user values ('wiske.its.unimacq.edu.au', 'root', password('getoff'), 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y');
Query OK, 1 row affected (0.00 sec)

mysql> delete from user where host='wiske';
Query OK, 2 rows affected (0.02 sec)

mysql> select * from user;
+--------------------------+------+------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+
| Host                     | User | Password         | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv |
+--------------------------+------+------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+
| localhost                | root | 21565a181fefda91 | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          |
| localhost                |      |                  | N           | N           | N           | N           | N           | N         | N           | N             | N            | N         | N          | N               | N          | N          |
| wiske.its.unimacq.edu.au | root | 21565a181fefda91 | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          |
+--------------------------+------+------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+
3 rows in set (0.00 sec)

[http@wiske mysql]$ bin/mysql -h wiske -u root -pgetoff
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 3.23.54-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> 

## MySQL start / stop script

[http@wiske mysql]$ cat bin/mysqld.sh

#!/bin/sh
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
# This file is public domain and comes with NO WARRANTY of any kind

# Mysql daemon start/stop script.

# Usually this is put in /etc/init.d (at least on machines SYSV R4 based
# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/S01mysql.
# When this is done the mysql server will be started when the machine is
# started and shut down when the systems goes down.

# Comments to support chkconfig on RedHat Linux
# chkconfig: 2345 90 90
# description: A very fast and reliable SQL database engine.

# Comments to support LSB init script conventions
### BEGIN INIT INFO
# Provides: mysql
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start:  3 5
# Default-Stop: 3 5
# Short-Description: start and stop MySQL
# Description: MySQL is a very fast and reliable SQL database engine.
### END INIT INFO
 

# The following variables are only set for letting mysql.server find things.
# If you want to affect other MySQL variables, you should make your changes
# in the /etc/my.cnf or other configuration files.

PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH

# Set some defaults
datadir=/siwc/sgml/www.it-security.unimacq.edu.au/mysql
basedir=/servers/web/mysql
pid_file=

if test -z "$basedir"
then
  basedir=/usr/local/mysql
  bindir=./bin
else
  bindir="$basedir/bin"
fi

if test -z "$pid_file"
then
  pid_file=$datadir/`hostname`.pid
else
  case "$pid_file" in
    /* ) ;;
    * )  pid_file="$datadir/$pid_file" ;;
  esac
fi

mode=$1    # start or stop

parse_arguments() {
  for arg do
    case "$arg" in
      --basedir=*)  basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
      --datadir=*)  datadir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
      --pid-file=*) pid_file=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
    esac
  done
}

# Get arguments from the my.cnf file, groups [mysqld] and [mysql_server]
if test -x ./bin/my_print_defaults
then
  print_defaults="./bin/my_print_defaults"
elif test -x $bindir/my_print_defaults
then
  print_defaults="$bindir/my_print_defaults"
elif test -x $bindir/mysql_print_defaults
then
  print_defaults="$bindir/mysql_print_defaults"
else
  # Try to find basedir in /etc/my.cnf
  conf=/etc/my.cnf
  print_defaults=
  if test -r $conf
  then
    subpat='^[^=]*basedir[^=]*=\(.*\)$'
    dirs=`sed -e "/$subpat/!d" -e 's//\1/' $conf`
    for d in $dirs
    do
      d=`echo $d | sed -e 's/[ 	]//g'`
      if test -x "$d/bin/my_print_defaults"
      then
        print_defaults="$d/bin/my_print_defaults"
        break
      fi
      if test -x "$d/bin/mysql_print_defaults"
      then
        print_defaults="$d/bin/mysql_print_defaults"
        break
      fi
    done
  fi

  # Hope it's in the PATH ... but I doubt it
  test -z "$print_defaults" && print_defaults="$basedir/bin/my_print_defaults"
fi

parse_arguments `$print_defaults $defaults mysqld mysql_server`

# Safeguard (relative paths, core dumps..)
cd $basedir

case "$mode" in
  'start')
    # Start daemon

    if test -x $bindir/safe_mysqld
    then
      # Give extra arguments to mysqld with the my.cnf file. This script may
      # be overwritten at next upgrade.
      $bindir/safe_mysqld --basedir=$basedir --datadir=$datadir --pid-file=$pid_file --ledir=$basedir/bin &
      # Make lock for RedHat / SuSE
      if test -w /var/lock/subsys
      then
        touch /var/lock/subsys/mysql
      fi
    else
      echo "Can't execute $bindir/safe_mysqld"
    fi
    ;;

  'stop')
    # Stop daemon. We use a signal here to avoid having to know the
    # root password.
    if test -f "$pid_file"
    then
      mysqld_pid=`cat $pid_file`
      echo "Killing mysqld with pid $mysqld_pid"
      kill $mysqld_pid
      # mysqld should remove the pid_file when it exits, so wait for it.

      sleep 1
      while [ -s $pid_file -a "$flags" != aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ]
      do
        [ -z "$flags" ] && echo "Wait for mysqld to exit\c" || echo ".\c"
        flags=a$flags
        sleep 1
      done
      if [ -s $pid_file ]
         then echo " gave up waiting!"
      elif [ -n "$flags" ]
         then echo " done"
      fi
      # delete lock for RedHat / SuSE
      if test -f /var/lock/subsys/mysql
      then
        rm /var/lock/subsys/mysql
      fi
    else
      echo "No mysqld pid file found. Looked for $pid_file."
    fi
    ;;

  *)
    # usage
    echo "usage: $0 start|stop"
    exit 1
    ;;
esac

Google