guo20082200的个人博客分享 http://blog.sciencenet.cn/u/guo20082200

博文

linux_centos 第24次课 LAMP的搭建之一:MySQL的安装

已有 2001 次阅读 2015-8-20 16:51 |个人分类:Linux学习|系统分类:科研笔记|关键词:学者| 数据库, style

24次课 LAMP的搭建

 

数据库mySQL源码包下载:http://mirrors.sohu.com/mysql/MySQL-4.1/

 

1.    安装mysql

cd /usr/local/src/
wget
http://syslab.comsenz.com/downloads/linux/mysql-5.1.40-linux-i686-icc-glibc23.tar.gz

注意:上面的地址是32位机器用的,如果你的机器是64位,下载这个包(http://syslab.comsenz.com/downloads/linux/mysql-5.1.40-linux-x86_64-icc-glibc23.tar.gz)安装方法是一样的。

[root@ghq src]# wgethttp://syslab.comsenz.com/downloads/linux/mysql-5.1.40-linu                                x-i686-icc-glibc23.tar.gz

--2015-08-19 22:46:54-- http://syslab.comsenz.com/downloads/linux/mysql-5.1.40-                                 linux-i686-icc-glibc23.tar.gz

Resolving syslab.comsenz.com...101.227.130.115

Connecting tosyslab.comsenz.com|101.227.130.115|:80... connected.

HTTP request sent, awaitingresponse... 200 OK

Length: 123633020 (118M)[application/octet-stream]

Saving to:“mysql-5.1.40-linux-i686-icc-glibc23.tar.gz”

[root@ghq ~]# cd /usr/local/src

[root@ghq src]# ls

mysql-5.1.40-linux-i686-icc-glibc23.tar.gz

[root@ghq src]# du -shmysql-5.1.40-linux-i686-icc-glibc23.tar.gz

118M    mysql-5.1.40-linux-i686-icc-glibc23.tar.gz

解压

[root@ghqsrc]# tar zxf mysql-5.1.40-linux-i686-icc-glibc23.tar.gz              [root@ghq src]# ls

mysql-5.1.40-linux-i686-icc-glibc23  mysql-5.1.40-linux-i686-icc-glibc23.tar.gz

移动目录:

[root@ghq src]# mv mysql-5.1.40-linux-i686-icc-glibc23/usr/local/mysql

 

[root@ghq src]# cd /usr/local

[root@ghq local]# ls

bin  etc games  include  lib libexec  mysql  sbin share  src

[root@ghq local]# cd mysql

[root@ghq mysql]# ls

bin      docs               INSTALL-BINARY  mysql-test share

COPYING  EXCEPTIONS-CLIENT  lib             README      sql-bench

data     include            man             scripts     support-files

 

[root@ghq mysql]#useradd -s /sbin/nologin -M mysql-M,不创建家目录)

[root@ghq mysql]# ls /home

Guo

为什么用mkdir创建的目录都在根目录下??

[root@ghq mysql]# cd /data

[root@ghq data]# ls

mysq

[root@ghq data]# rm mysq

rm: cannot remove `mysq': Is adirectory

[root@ghq data]# rmdir mysq

[root@ghq data]# ls

[root@ghq data]# mkdir mysql

[root@ghq data]# ls

mysql

[root@ghq data]# chown -Rmysql:mysql /data/mysql

[root@ghq data]# ls/etc/my.cnf

/etc/my.cnf

[root@ghq data]# cat/etc/my.cnf

[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

user=mysql

# Disabling symbolic-links isrecommended to prevent assorted security risks

symbolic-links=0

 

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

 

[root@ghq data]# find /-name my-huge.cnf

/usr/local/mysql/support-files/my-huge.cnf

[root@ghq data]# cd/usr/local/mysql/support-files

[root@ghq support-files]# ls

binary-configure   my-huge.cnf             mysqld_multi.server

config.huge.ini    my-innodb-heavy-4G.cnf  mysql-log-rotate

config.medium.ini  my-large.cnf            mysql.server

config.small.ini   my-medium.cnf           ndb-config-2-node.ini

magic              my-small.cnf

 

[root@ghq mysql]# cp/usr/local/mysql/support-files/my-huge.cnf /etc/my.cnf

(不要源文件)

cp: overwrite `/etc/my.cnf'? y

 

[root@ghq mysql]# vim/etc/my.cnf

[root@ghq mysql]#cat /etc/my.cnf

# Example MySQL config file forvery large systems.

#

# This is for a large system withmemory of 1G-2G where the system runs mainly

# MySQL.

#

# You can copy this file to

# /etc/my.cnf to set globaloptions,

# mysql-data-dir/my.cnf to setserver-specific options (in this

# installation this directory is/usr/local/mysql/data) or

# ~/.my.cnf to set user-specificoptions.

#

# In this file, you can use alllong options that a program supports.

# If you want to know whichoptions a program supports, run the program

# with the "--help"option.

 

# The following options will bepassed to all MySQL clients

[client]

#password       = your_password

port            = 3306 (监听的端口)

socket          = /tmp/mysql.sock (监听的socket

 

# Here follows entries for somespecific programs

 

# The MySQL server

[mysqld]

port            = 3306

socket          = /tmp/mysql.sock

skip-locking

key_buffer_size = 384M定义mysql使用的内存的大小,比较重要

max_allowed_packet = 1M

table_open_cache = 512

sort_buffer_size = 2M

read_buffer_size = 2M

read_rnd_buffer_size = 8M

myisam_sort_buffer_size = 64M

thread_cache_size = 8

query_cache_size = 32M

# Try number of CPU's*2 forthread_concurrency

thread_concurrency = 8

 

# Don't listen on a TCP/IP portat all. This can be a security enhancement,

# if all processes that need toconnect to mysqld run on the same host.

# All interaction with mysqld mustbe made via Unix sockets or named pipes.

# Note that using this optionwithout enabling named pipes on Windows

# (via the"enable-named-pipe" option) will render mysqld useless!

#

#skip-networking

 

# Replication Master Server(default)

# binary logging is required forreplication

log-bin=mysql-bin记录二进制日志,不需要,可以注释掉

 

# required unique id between 1and 2^32 - 1

# defaults to 1 if master-host isnot set

# but will not function as amaster if omitted

server-id       = 1

 

# Replication Slave (comment outmaster section to use this)

#

# To configure this host as areplication slave, you can choose between

# two methods :

#

# 1) Use the CHANGE MASTER TOcommand (fully described in our manual) -

#    the syntax is:

#

#    CHANGE MASTER TO MASTER_HOST=<host>,MASTER_PORT=<port>,

#    MASTER_USER=<user>,MASTER_PASSWORD=<password> ;

#

#    where you replace <host>,<user>, <password> by quoted strings and

#    <port> by the master's port number(3306 by default).

#

#    Example:

#

#    CHANGE MASTER TO MASTER_HOST='125.564.12.1',MASTER_PORT=3306,

#    MASTER_USER='joe',MASTER_PASSWORD='secret';

#

# OR

#

# 2) Set the variables below.However, in case you choose this method, then

#    start replication for the first time (evenunsuccessfully, for example

#    if you mistyped the password inmaster-password and the slave fails to

#    connect), the slave will create amaster.info file, and any later

#    change in this file to the variables'values below will be ignored and

#    overridden by the content of themaster.info file, unless you shutdown

#    the slave server, delete master.info andrestart the slaver server.

#    For that reason, you may want to leave thelines below untouched

#    (commented) and instead use CHANGE MASTERTO (see above)

#

# required unique id between 2and 2^32 - 1

# (and different from the master)

# defaults to 2 if master-host isset

# but will not function as aslave if omitted

#server-id       = 2

#

# The replication master for thisslave - required

#master-host     =  <hostname>

#

# The username the slave will usefor authentication when connecting

# to the master - required

#master-user     =  <username>

#

# The password the slave willauthenticate with when connecting to

# the master - required

#master-password =   <password>

#

# The port the master islistening on.

# optional - defaults to 3306

#master-port     = <port>

#

# binary logging - not requiredfor slaves, but recommended

#log-bin=mysql-bin

#

# binary logging format - mixedrecommended

#binlog_format=mixed

 

# Point the following paths todifferent dedicated disks

#tmpdir         = /tmp/

#log-update     = /path-to-dedicated-directory/hostname

 

# Uncomment the following if youare using InnoDB tables

#innodb_data_home_dir =/usr/local/mysql/data/

#innodb_data_file_path =ibdata1:2000M;ibdata2:10M:autoextend

#innodb_log_group_home_dir =/usr/local/mysql/data/

# You can set .._buffer_pool_sizeup to 50 - 80 %

# of RAM but beware of settingmemory usage too high

#innodb_buffer_pool_size = 384M

#innodb_additional_mem_pool_size= 20M

# Set .._log_file_size to 25 % ofbuffer pool size

#innodb_log_file_size = 100M

#innodb_log_buffer_size = 8M

#innodb_flush_log_at_trx_commit =1

#innodb_lock_wait_timeout = 50

 

[mysqldump]

quick

max_allowed_packet = 16M

 

[mysql]

no-auto-rehash

# Remove the next commentcharacter if you are not familiar with SQL

#safe-updates

 

[myisamchk]

key_buffer_size = 256M

sort_buffer_size = 256M

read_buffer = 2M

write_buffer = 2M

 

[mysqlhotcopy]

interactive-timeout

 

 

[root@ghq mysql]# cp/usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

 

[root@ghq mysql]# cat/etc/init.d/mysqld

#!/bin/sh

# Copyright Abandoned 1996 TCXDataKonsult AB & Monty Program KB & Detron HB

# This file is public domain andcomes 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/K01mysql.

# When this is done the mysqlserver will be started when the machine is

# started and shut down when thesystems goes down.

 

# Comments to support chkconfigon RedHat Linux

# chkconfig: 2345 64 36

# description: A very fast andreliable SQL database engine.

 

# Comments to support LSB initscript conventions

### BEGIN INIT INFO

# Provides: mysql

# Required-Start: $local_fs$network $remote_fs

# Should-Start: ypbind nscd ldapntpd xntpd

# Required-Stop: $local_fs$network $remote_fs

# Default-Start:  2 3 4 5

# Default-Stop: 0 1 6

# Short-Description: start andstop MySQL

# Description: MySQL is a veryfast and reliable SQL database engine.

### END INIT INFO

 

# If you install MySQL on someother places than /usr/local/mysql, then you

# have to do one of the followingthings for this script to work:

#

# - Run this script from within theMySQL installation directory

# - Create a /etc/my.cnf filewith the following information:

#   [mysqld]

#  basedir=<path-to-mysql-installation-directory>

# - Add the above to any otherconfiguration file (for example ~/.my.ini)

#   and copy my_print_defaults to /usr/bin

# - Add the path to themysql-installation-directory to the basedir variable

#   below.

#

# If you want to affect otherMySQL variables, you should make your changes

# in the /etc/my.cnf, ~/.my.cnfor other MySQL configuration files.

 

# If you change base dir, youmust also change datadir. These may get

# overwritten by settings in theMySQL configuration files.

 

basedir= (是我们mysql程序服务所在的目录,可以定义为/usr/local/mysql

datadir= /data/mysql,最核心的,需要定义的)

 

# Default value, in seconds,afterwhich the script should timeout waiting

# for server start.

# Value here is overriden byvalue in my.cnf.

# 0 means don't wait at all

# Negative numbers mean to waitindefinitely

service_startup_timeout=900

 

# The following variables areonly set for letting mysql.server find things.

 

# Set some defaults

pid_file=

server_pid_file=

use_mysqld_safe=1

user=mysql

if test -z "$basedir"

then

basedir=/usr/local/mysql

bindir=./bin

if test -z "$datadir"

then

   datadir=/usr/local/mysql/data

fi

sbindir=./bin

libexecdir=./bin

else

bindir="$basedir/bin"

if test -z "$datadir"

then

   datadir="$basedir/data"

fi

sbindir="$basedir/sbin"

libexecdir="$basedir/libexec"

fi

 

# datadir_set is used todetermine if datadir was set (and so should be

# *not* set inside of the--basedir= handler.)

datadir_set=

 

#

# Use LSB init script functionsfor printing messages, if possible

#

lsb_functions="/lib/lsb/init-functions"

if test -f $lsb_functions ; then

. $lsb_functions

else

log_success_msg()

{

   echo " SUCCESS! $@"

}

log_failure_msg()

{

   echo " ERROR! $@"

}

fi

 

PATH=/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin

export PATH

 

mode=$1    # start or stop

shift

other_args="$*"   # uncommon, but needed when called from anRPM upgrade action

          # Expected: "--skip-networking--skip-grant-tables"

          # They are not checked here,intentionally, as it is the resposibility

          # of the "spec" fileauthor to give correct arguments only.

 

case `echo"testing\c"`,`echo -n testing` in

   *c*,-n*) echo_n=   echo_c=    ;;

   *c*,*)  echo_n=-n echo_c=     ;;

   *)      echo_n=   echo_c='\c' ;;

esac

 

parse_server_arguments() {

for arg do

   case "$arg" in

     --basedir=*)  basedir=`echo "$arg" | sed -e's/^[^=]*=//'`

                   bindir="$basedir/bin"

                   if test -z"$datadir_set"; then

                    datadir="$basedir/data"

                   fi

                  sbindir="$basedir/sbin"

                  libexecdir="$basedir/libexec"

       ;;

     --datadir=*)  datadir=`echo "$arg" | sed -e's/^[^=]*=//'`

                   datadir_set=1

       ;;

     --user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;

     --pid-file=*) server_pid_file=`echo"$arg" | sed -e 's/^[^=]*=//'` ;;

     --service-startup-timeout=*)service_startup_timeout=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;

     --use-mysqld_safe) use_mysqld_safe=1;;

     --use-manager)     use_mysqld_safe=0;;

   esac

done

}

 

parse_manager_arguments() {

for arg do

   case "$arg" in

     --pid-file=*) pid_file=`echo"$arg" | sed -e 's/^[^=]*=//'` ;;

     --user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;

   esac

done

}

 

wait_for_pid () {

verb="$1"

manager_pid="$2"  #process ID of the program operating on the pid-file

i=0

avoid_race_condition="by checking again"

while test $i -ne $service_startup_timeout ; do

 

   case "$verb" in

     'created')

       # wait for a PID-file to pop intoexistence.

       test -s $pid_file && i=''&& break

       ;;

     'removed')

       # wait for this PID-file to disappear

       test ! -s $pid_file && i=''&& break

       ;;

     *)

       echo "wait_for_pid () usage:wait_for_pid created|removed manager_pid"

       exit 1

       ;;

   esac

 

  # if manager isn't running, thenpid-file will never be updated

   if test -n "$manager_pid"; then

     if kill -0 "$manager_pid"2>/dev/null; then

       : # the manager still runs

     else

       # The manager may have exited betweenthe last pid-file check and now.

       if test -n"$avoid_race_condition"; then

         avoid_race_condition=""

         continue  # Check again.

       fi

 

       # there's nothing that will affect thefile.

       log_failure_msg "Manager ofpid-file quit without updating file."

       return 1  # not waiting any more.

     fi

   fi

 

   echo $echo_n ".$echo_c"

   i=`expr $i + 1`

   sleep 1

done

 

if test -z "$i" ; then

   log_success_msg

   return 0

else

   log_failure_msg

   return 1

fi

}

 

# Get arguments from the my.cnffile,

# the only group, which is readfrom now on is [mysqld]

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="my_print_defaults"

fi

 

#

# Read defaults file from'basedir'.   If there is no defaults filethere

# check if it's in the old(depricated) place (datadir) and read it from there

#

 

extra_args=""

if test -r"$basedir/my.cnf"

then

extra_args="-e $basedir/my.cnf"

else

if test -r "$datadir/my.cnf"

then

   extra_args="-e $datadir/my.cnf"

fi

fi

 

parse_server_arguments`$print_defaults $extra_args mysqld server mysql_server mysql.server`

 

# Look for the pidfile

parse_manager_arguments`$print_defaults $extra_args manager`

 

#

# Set pid file if not given

#

if test -z "$pid_file"

then

pid_file=$datadir/mysqlmanager-`/bin/hostname`.pid

else

case "$pid_file" in

   /* ) ;;

   * ) pid_file="$datadir/$pid_file" ;;

esac

fi

if test -z"$server_pid_file"

then

server_pid_file=$datadir/`/bin/hostname`.pid

else

case "$server_pid_file" in

   /* ) ;;

   * ) server_pid_file="$datadir/$server_pid_file" ;;

esac

fi

 

case "$mode" in

'start')

   # Start daemon

 

   # Safeguard (relative paths, core dumps..)

  cd $basedir

 

   manager=$bindir/mysqlmanager

   if test -x $libexecdir/mysqlmanager

   then

     manager=$libexecdir/mysqlmanager

   elif test -x $sbindir/mysqlmanager

   then

     manager=$sbindir/mysqlmanager

   fi

 

   echo $echo_n "Starting MySQL"

   if test -x $manager -a"$use_mysqld_safe" = "0"

   then

     if test -n "$other_args"

     then

       log_failure_msg "MySQL managerdoes not support options '$other_args'"

       exit 1

     fi

     # Give extra arguments to mysqld with themy.cnf file. This script may

     # be overwritten at next upgrade.

     "$manager" \

       --mysqld-safe-compatible \

       --user="$user" \

       --pid-file="$pid_file">/dev/null 2>&1 &

     wait_for_pid created $!; return_value=$?

 

     # Make lock for RedHat / SuSE

     if test -w /var/lock/subsys

     then

       touch /var/lock/subsys/mysqlmanager

     fi

     exit $return_value

   elif test -x $bindir/mysqld_safe

   then

     # Give extra arguments to mysqld with themy.cnf file. This script

     # may be overwritten at next upgrade.

     pid_file=$server_pid_file

     $bindir/mysqld_safe --datadir=$datadir--pid-file=$server_pid_file $other_args >/dev/null 2>&1 &

     wait_for_pid created $!; return_value=$?

 

     # Make lock for RedHat / SuSE

     if test -w /var/lock/subsys

     then

       touch /var/lock/subsys/mysql

     fi

     exit $return_value

   else

     log_failure_msg "Couldn't find MySQLmanager ($manager) or server ($bindir/mysqld_safe)"

   fi

   ;;

 

'stop')

   # Stop daemon. We use a signal here toavoid having to know the

   # root password.

 

   # The RedHat / SuSE lock directory to remove

   lock_dir=/var/lock/subsys/mysqlmanager

 

   # If the manager pid_file doesn't exist,try the server's

   if test ! -s "$pid_file"

   then

     pid_file=$server_pid_file

     lock_dir=/var/lock/subsys/mysql

   fi

 

   if test -s "$pid_file"

   then

     mysqlmanager_pid=`cat $pid_file`

 

     if (kill -0 $mysqlmanager_pid2>/dev/null)

     then

       echo $echo_n "Shutting downMySQL"

       kill $mysqlmanager_pid

       # mysqlmanager should remove thepid_file when it exits, so wait for it.

       wait_for_pid removed"$mysqlmanager_pid"; return_value=$?

     else

       log_failure_msg "MySQL manager orserver process #$mysqlmanager_pid is not running!"

       rm $pid_file

     fi

 

     # delete lock for RedHat / SuSE

     if test -f $lock_dir

     then

       rm -f $lock_dir

     fi

     exit $return_value

   else

     log_failure_msg "MySQL manager orserver PID file could not be found!"

   fi

  ;;

 

'restart')

   # Stop the service and regardless ofwhether it was

   # running or not, start it again.

   if $0 stop $other_args; then

     $0 start $other_args

   else

     log_failure_msg "Failed to stoprunning server, so refusing to try to start."

     exit 1

   fi

   ;;

 

'reload'|'force-reload')

   if test -s "$server_pid_file" ;then

     read mysqld_pid <  $server_pid_file

     kill -HUP $mysqld_pid &&log_success_msg "Reloading service MySQL"

     touch $server_pid_file

   else

     log_failure_msg "MySQL PID filecould not be found!"

     exit 1

   fi

   ;;

'status')

   # First, check to see if pid file exists

   if test -s "$server_pid_file" ;then

     read mysqld_pid < $server_pid_file

     if kill -0 $mysqld_pid 2>/dev/null ;then

       log_success_msg "MySQL running($mysqld_pid)"

       exit 0

     else

       log_failure_msg "MySQL is notrunning, but PID file exists"

       exit 1

     fi

   else

     # Try to find appropriate mysqld process

    mysqld_pid=`pidof$libexecdir/mysqld`

     if test -z $mysqld_pid ; then

       if test "$use_mysqld_safe" ="0" ; then

        lockfile=/var/lock/subsys/mysqlmanager

       else

         lockfile=/var/lock/subsys/mysql

       fi

       if test -f $lockfile ; then

         log_failure_msg "MySQL is notrunning, but lock exists"

         exit 2

       fi

       log_failure_msg "MySQL is notrunning"

       exit 3

     else

       log_failure_msg "MySQL is runningbut PID file could not be found"

       exit 4

     fi

   fi

   ;;

   *)

     # usage

     echo "Usage: $0 {start|stop|restart|reload|force-reload|status}  [ MySQL server options ]"

     exit 1

   ;;

esac

 

exit 0

 

初始化:

[root@ghq mysql]#./scripts/mysql_install_db --user=mysql --datadir=/data/mysql

WARNING: The host'ghq' could not be looked up with resolveip.

This probably meansthat your libc libraries are not 100 % compatible

with this binaryMySQL version. The MySQL daemon, mysqld, should work

normally with theexception that host name resolving will not work.

This means that youshould use IP addresses instead of hostnames

when specifyingMySQL privileges !

多了一个警告

Installing MySQL system tables...

OK

Filling help tables...

OK

 

To start mysqld at boot time youhave to copy

support-files/mysql.server to theright place for your system

 

PLEASE REMEMBER TO SET A PASSWORDFOR THE MySQL root USER !

To do so, start the server, thenissue the following commands:

 

./bin/mysqladmin -u root password'new-password'

./bin/mysqladmin -u root -h ghqpassword 'new-password'

 

Alternatively you can run:

./bin/mysql_secure_installation

 

which will also give you theoption of removing the test

databases and anonymous usercreated by default.  This is

strongly recommended forproduction servers.

 

See the manual for moreinstructions.

 

You can start the MySQL daemonwith:

cd . ; ./bin/mysqld_safe &

 

You can test the MySQL daemonwith mysql-test-run.pl

cd ./mysql-test ; perlmysql-test-run.pl

 

Please report any problems withthe ./bin/mysqlbug script!

 

The latest information aboutMySQL is available at http://www.mysql.com/

Support MySQL by buyingsupport/licenses from http://shop.mysql.com/

 

[root@ghq mysql]# ls data

mysql  test

[root@ghq mysql]#/etc/init.d/mysqld start

Starting MySQL. SUCCESS!

[root@ghq mysql]# psaux|grep mysql

root      3586 0.0  0.1   5068 1232 pts/1    S    01:31  0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql--pid-file=/data/mysql/ghq.pid

mysql     3686 0.8  2.7 266952 28356 pts/1    Sl  01:31   0:00/usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql--user=mysql --log-error=/data/mysql/ghq.err --pid-file=/data/mysql/ghq.pid--socket=/tmp/mysql.sock --port=3306

root      3702 0.0  0.0   4356  728 pts/1    S+   01:32  0:00 grep mysql

 

[root@ghq mysql]# ls /data/mysql

ghq.err  ghq.pid ibdata1  ib_logfile0  ib_logfile1 mysql  test

 

[root@ghq mysql]# mysql

-bash: mysql: commandnot found

[root@ghq mysql]#/usr/local/mysql/bin/mysql

Welcome to the MySQL monitor.  Commands end with ; or g.

Your MySQL connection id is 1

Server version: 5.1.40 MySQLCommunity Server (GPL)

 

Type 'help;' or 'h' for help.Type 'c' to clear the current input statement.

 

mysql>


24.docx



https://m.sciencenet.cn/blog-575910-914546.html

上一篇:linux_centos第14次课 shell基础
下一篇:linux_centos 第24次课 LAMP的搭建之一:MySQL的安装

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-6-2 15:01

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部