`
coffee_yan
  • 浏览: 36359 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

MySQL-5.6.30安装笔记【源码安装】

阅读更多
二进制安装包:
mysql-5.6.30.tar.gz

操作系统:
CentOS 6.6

所需依赖包:
gcc
gcc-c++
cmake
libaio
ncurses-devel
根据系统不同,可能还有缺失其他依赖包,导致编译出错,在此不一一列举了


安装步骤:
[root@localhost ~]# useradd mysql
[root@localhost ~]# su - mysql
[mysql@localhost ~]$ mkdir mysql_base
[mysql@localhost ~]$ mkdir mysql_data
[mysql@localhost ~]$ tar zxvf mysql-5.6.30.tar.gz

[mysql@localhost ~]$ cd mysql-5.6.30

[mysql@localhost ~]$ cmake . -DCMAKE_INSTALL_PREFIX=/home/mysql/mysql_base -DMYSQL_DATADIR=/home/mysql/mysql_data -DMYSQL_TCP_PORT=3306 -DSYSCONFDIR=/home/mysql_base/etc -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1

[mysql@localhost ~]$  make
[mysql@localhost ~]$  make install

[mysql@localhost ~]$ cd /home/mysql/mysql_base/scripts


初始化数据库:
[mysql@localhost scripts]$ ./mysql_install_db --user=mysql --basedir=/home/mysql/mysql_base --datadir=/home/mysql/mysql_data
初始化之后,在mysql_base路径下会出现my.cnf配置文件


my.cnf 配置
[mysqld]
innodb_buffer_pool_size = 128M
basedir=/home/mysql/mysql_base
datadir=/home/mysql/mysql_data
port=3306
default-storage-engine=InnoDB
character-set-server=utf8
open_files_limit=4096

socket=/tmp/mysql.sock

[mysql]
default-character-set=utf8

[mysqld_safe]
log-error=/home/mysql/mysql_base/var/log/mysqld.log



配置环境变量,将/home/mysql/mysql_base/bin加入到PATH环境变量中,保证各登录用户可以找到mysql相关命令!
安全设置,包括设置root密码
[mysql@localhost ~]$ mysql_secure_installation


启动数据库:

[mysql@localhost ~]$ cp /home/mysql/mysql_base/support-files/mysql.server /etc/init.d/mysqld
[mysql@localhost ~]$ /etc/init.d/mysqld start


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics