[root@mastera0 ~]# tar -xf mysql-5.6.20-linux-glibc2.5-x86_64.tar.gz [root@mastera0 ~]# cd mysql-5.6.20-linux-glibc2.5-x86_64 [root@mastera0 mysql-5.6.20-linux-glibc2.5-x86_64]# ls bin COPYING data docs include INSTALL-BINARY lib man mysql-test README scripts share sql-bench support-files [root@mastera0 mysql-5.6.20-linux-glibc2.5-x86_64]# cat INSTALL-BINARY ... ... To install and use a MySQL binary distribution, the basic command sequence looks like this: shell> groupadd mysql shell> useradd -r -g mysql mysql shell> cd /usr/local shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz shell> ln -s full-path-to-mysql-VERSION-OS mysql shell> cd mysql shell> chown -R mysql . shell> chgrp -R mysql . shell> scripts/mysql_install_db --user=mysql shell> chown -R root . shell> chown -R mysql data shell> bin/mysqld_safe --user=mysql & # Next command is optional shell> cp support-files/mysql.server /etc/init.d/mysql.server ... ...
[root@mastera0 mysql-5.6.20-linux-glibc2.5-x86_64]# groupadd mysql [root@mastera0 mysql-5.6.20-linux-glibc2.5-x86_64]# cd .. [root@mastera0 ~]# useradd -r -g mysql mysql [root@mastera0 ~]# cd /usr/local [root@mastera0 local]# mv /root/mysql-5.6.20-linux-glibc2.5-x86_64 . [root@mastera0 local]# ls bin games lib libexec sbin src etc include lib64 mysql-5.6.20-linux-glibc2.5-x86_64 share [root@mastera0 local]# ln -s mysql-5.6.20-linux-glibc2.5-x86_64 mysql [root@mastera0 local]# ll mysql lrwxrwxrwx. 1 root root 34 Dec 11 12:20 mysql -> mysql-5.6.20-linux-glibc2.5-x86_64 [root@mastera0 mysql]# cd mysql [root@mastera0 mysql]# mkdir /data/mysql/data -p [root@mastera0 mysql]# chown mysql. /data/mysql/data [root@mastera0 mysql]# chown mysql. /data/mysql/data -R [root@mastera0 mysql]# ll -d /data/mysql/data drwxr-xr-x. 2 mysql mysql 4096 Dec 11 12:24 /data/mysql/data [root@mastera0 mysql]# scripts/mysql_install_db --user=mysql --datadir=/data/mysql/data --basedir=/usr/local/mysql
[root@mastera0 mysql]# ll /data/mysql/data total 110604 -rw-rw----. 1 mysql mysql 12582912 Dec 11 12:28 ibdata1 -rw-rw----. 1 mysql mysql 50331648 Dec 11 12:28 ib_logfile0 -rw-rw----. 1 mysql mysql 50331648 Dec 11 12:28 ib_logfile1 drwx------. 2 mysql mysql 4096 Dec 11 12:28 mysql drwx------. 2 mysql mysql 4096 Dec 11 12:28 performance_schema drwx------. 2 mysql mysql 4096 Dec 11 12:28 test [root@mastera0 mysql]# cp /mnt/mysql/my.cnf /etc/my.cnf [root@mastera0 mysql]# vim /etc/my.cnf [client] #如果不认识这个参数会忽略 loose-default-character-set=utf8 loose-prompt='\u@\h:\p [\d]>' socket=/tmp/mysql.sock