mysql-5.6.21源代码安装步骤:
1.解压安装包
tar -zxvf mysql-5.6.21.tar.gz2.编译源代码
cmake . -DCMAKE_INSTALL_PREFIX=/data/gg/3321/mysql-5.6.21 -DMYSQL_DATADIR=/data/gg/3321/mysql-5.6.21/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1
make
make install
3.创建数据库
cd scripts
./mysql_install_db --user=mysql --basedir=/data/gg/3321/mysql-5.6.21 --datadir=/data/gg/3321/mysql-5.6.21/data
4.启动报错
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
ln -s /tmp/mysql.sock /data/gg/3321/mysql-5.6.21/mysql.sock
5.启动命令
/data/gg/3321/mysql-5.6.21/bin/mysqld_safe --defaults-file=/data/gg/3321/mysql-5.6.21/my.cnf &
[mysql@used mysql-5.6.21]$ more my.cnf
[mysqld]
port = 3321
datadir=/data/gg/3321/mysql-5.6.21/data
slow_query_log=1
slow_query_log_file=/data/gg/3321/mysql-5.6.21/slow.log
long_query_time=1
user=mysql
init_connect='set names utf8'
server-id=3321
#innodb_flush_log_at_trx_commit=0
log-bin=mysql-bin
key_buffer_size=2M
read_buffer_size=64M
skip-host-cache
skip-name-resolve
#skip-grant-tables
max_allowed_packet = 32G
character_set_server=utf8
max_connections=100
net_read_timeout=300
net_write_timeout=300
connect_timeout=300
innodb_lock_wait_timeout=300
[mysqld_safe]
log_error=/data/gg/3321/mysql-5.6.21/error.log
pid_file=/data/gg/3321/mysql-5.6.21/10.10.15.208.pid
[client]
default_character_set=utf8
[mysqldump]
socket = /data/gg/3321/mysql-5.6.21/mysql.sock
6.登录mysql
mysql -hlocalhost -uroot -p -P3321 --socket=/data/gg/3321/mysql-5.6.21/mysql.sock
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.21-log Source distribution
Copyright (c) 2000, 2013, 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> set password = password('root');--修改密码
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)