Create a mysql User and Group
shell> groupadd mysql
shell> useradd -r -g mysql mysql
root@AY1404291627285121bcZ:/# groupadd mysql^C
root@AY1404291627285121bcZ:/# cd
root@AY1404291627285121bcZ:~# groupadd mysql
root@AY1404291627285121bcZ:~# useradd -r -g mysql mysql
root@AY1404291627285121bcZ:~# cd software/
Obtain and Unpack the Distribution
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
root@AY1404291627285121bcZ:~/software# tar -xzf mysql-5.6.17-linux-glibc2.5-x86_64.tar.gz -C /usr/local/
root@AY1404291627285121bcZ:~/software# cd /usr/local/
root@AY1404291627285121bcZ:/usr/local# ln -s mysql-5.6.17-linux-glibc2.5-x86_64 mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
root@AY1404291627285121bcZ:/usr/local# cd mysql
root@AY1404291627285121bcZ:/usr/local/mysql# chown -R mysql .
root@AY1404291627285121bcZ:/usr/local/mysql# chgrp -R mysql .
root@AY1404291627285121bcZ:/usr/local/mysql# mkdir /Application/mysql/data
root@AY1404291627285121bcZ:/usr/local/mysql# chown -R mysql:mysql /Application/mysql
shell> scripts/mysql_install_db --user=mysql
–basedir=/opt/mysql/mysql
–datadir=/opt/mysql/mysql/data
root@AY1404291627285121bcZ:/usr/local/mysql# scripts/mysql_install_db --user=mysql \
–basedir=/usr/local/mysql
–datadir=/Application/mysql/data
shell> chown -R root .
shell> chown -R mysql data
root@AY1404291627285121bcZ:/usr/local/mysql# chown -R root .
root@AY1404291627285121bcZ:/usr/local/mysql# chown -R mysql:mysql /Application/mysql
For advice on how to change settings please see
http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
[mysqld]
Remove leading # and set to the amount of RAM for the most important data
cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
innodb_buffer_pool_size = 128M
Remove leading # to turn on a very important data integrity option: logging
changes to the binary log between backups.
log_bin
These are commonly set, remove the # and set as required.
basedir =/usr/local/mysql
datadir =/Application/mysql/data
port = …
server_id = …
socket = …
character_set_server=utf8
Remove leading # to set options mainly useful for reporting servers.
The server defaults are faster for transactions and fast SELECTs.
Adjust sizes as needed, experiment to find the optimal values.
join_buffer_size = 128M
sort_buffer_size = 2M
read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
bin/mysqld_safe --user=mysql &
root@AY1404291627285121bcZ:/usr/local/mysql# bin/mysqld_safe --user=mysql &
root@AY1404291627285121bcZ:/usr/local/mysql# bin/mysqladmin -u root password ‘123456’
root@AY1404291627285121bcZ:/usr/local/mysql# killall mysqld
cp support-files/mysql.server /etc/init.d/mysql.server
root@AY1404291627285121bcZ:/usr/local/mysql# cp my.cnf /etc
root@AY1404291627285121bcZ:/usr/local/mysql# cp support-files/mysql.server /etc/init.d/
modify mysql.server:
basedir=/usr/local/mysql
datadir=/Application/mysql/data
root@AY1404291627285121bcZ:/usr/local/mysql# service mysql.server start
root@AY1404291627285121bcZ:/usr/local/mysql# service mysql.server stop
root@AY1404291627285121bcZ:/usr/local/mysql# bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.17 MySQL Community Server (GPL)
Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> status
bin/mysql Ver 14.14 Distrib 5.6.17, for linux-glibc2.5 (x86_64) using EditLine wrapper
Connection id: 1
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ‘’
Using delimiter: ;
Server version: 5.6.17 MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /tmp/mysql.sock
Uptime: 57 sec
Threads: 1 Questions: 5 Slow queries: 0 Opens: 67 Flush tables: 1 Open tables: 60 Queries per second avg: 0.087
mysql>
Add mysql/bin to PATH
root@AY1404291627285121bcZ:~# vi /etc/profile
export PATH=$PATH:/usr/local/mysql/bin