环境准备:
CentOS6.5 192.168.30.133
安装包准备:
下载安装包 mysql-5.6.15-linux-glibc2.5-x86_64.tar.gz
具体安装:
[[email protected]_RealServer bin]# cd /home/mysql [[email protected]_RealServer mysql]# tar -zxvf mysql-5.6.15-linux-glibc2.5-x86_64.tar.gz [[email protected]_RealServer mysql]# mv mysql-5.6.15-linux-glibc2.5-x86_64 mysql-5.6.15 [[email protected]_RealServer ~]# mkdir /mysql3306 [[email protected]_RealServer ~]# mkdir -p /mysql3306/data [[email protected]_RealServer ~]# mkdir -p /mysql3306/logs [[email protected]_RealServer ~]# mkdir -p /mysql3306/temp [[email protected]_RealServer ~]# chown -R mysql:mysql /mysql3306 [[email protected]_RealServer mysql]# chown -R mysql:mysql mysql-5.6.15/ su - mysql cd /mysql3306/data
vim my.cnf 编辑配置文件
[client] port = 3306 socket = /mysql3306/data/mysql.sock [mysqld] user=msql port=3306 #bind-address=0.0.0.0 socket = /mysql3306/data/mysql.sock.3306 pid-file = /mysql3306/data/mysql.pid basedir = /home/mysql/mysql-5.6.15 datadir = /mysql3306/data server-id=1 log-bin=mysql-bin log-bin-index= mysql-bin.index # LOGGING log_error=/mysql3306/logs/mysql-error.log slow_query_log_file= /mysql3306/logs/mysql-slow.log slow_query_log=1 character-sets-dir = /home/mysql/mysql-5.6.15/share/charsets back_log = 2000 max_connections = 1000 connect-timeout = 60 wait-timeout = 28800 net_buffer_length = 16384 max_allowed_packet = 64M thread_stack = 192K thread_cache_size = 20 thread_concurrency = 128 query_cache_size = 25M query_cache_limit = 2M query_cache_min_res_unit = 2 default-time-zone = system character-set-server = utf8 default-storage-engine = InnoDB tmp_table_size = 51M max_heap_table_size = 51M max_binlog_size = 1G max_relay_log_size = 1G [mysql] disable-auto-rehash default-character-set = utf8
保存my.cnf后 mysql帐号初始化数据库
cd /home/mysql/mysql-5.6.15 ./scripts/mysql_install_db --user=mysql --datadir=/mysql3306/data
可以启动数据库了,注意要加上响应的参数
mysql帐号下执行:
/home/mysql/mysql-5.6.15/bin/mysqld_safe --defaults-file=/mysql3306/my.cnf --user=mysql --basedir=/home/mysql/mysql-5.6.15 --datadir=/mysql3306/data/ --ledir=/home/mysql/mysql-5.6.15/bin/
如果不加最后--ledir参数,需要cd 到/home/mysql/mysql-5.6.15下执行上面的命令
mysql -h127.0.0.1 进入数据库进行相应的权限修改,密码修改等。
时间: 2024-10-07 05:49:43