mysql5.6编译安装(cmake方式)

1、 安装cmake

# tar xzvf cmake-2.8.8.tar.gz

# cd cmake-2.8.8

# ./configure

# gmake

# gmake install

2、 安装ncurses-devel

3、 安装mysql

3.1)创建用户及组

# groupadd mysql

# useradd -r -g mysql -s /bin/false mysql

3.2)解压安装包,cmake安装

# tar xzvf mysql-5.6.37.tar.gz

#cd mysql-5.6.37

# cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.6.37 \

-DMYSQL_DATADIR=/application/mysql-5.6.37/data \

-DMYSQL_UNIX_ADDR=/application/mysql-5.6.37/tmp/mysql.sock \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci \

-DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii \

-DENABLED_LOCAL_INFILE=ON \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_FEDERATED_STORAGE_ENGINE=1 \

-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \

-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \

-DWITHOUT_PARTITION_STORAGE_ENGINE=0 \

-DWITH_FAST_MUTEXES=1 \

-DWITH_ZLIB=bundled \

-DENABLED_LOCAL_INFILE=1 \

-DWITH_READLINE=1 \

-DWITH_EMBEDDED_SERVER=1 \

-DWITH_DEBUG=0

#make && make install 

说明:如果cmake出错,需要执行make clean; rm -f CMakeCache.txt

 4、配置系统环境变量:

export PATH=/application/mysql/bin:/application/mysql/scripts:$PATH将这行内容追加到/etc/profile文件结尾。

5、拷贝配置文件:

# cp support-files/my-default.cnf /etc/my.cnf

6、初始化数据库:

# mysql_install_db --user=mysql --basedir=/application/mysql-5.6.37 --datadir=/application/mysql-5.6.37/data

7、启动数据库:

# cp support-files/mysql.server /etc/init.d/mysqld

# chmod +x /etc/init.d/mysqld

# chown -R mysql:mysql application/

#mkdir /application/mysql-5.6.37/tmp

# chmod -R 1777 tmp

注意:安装过程中的报错

Linking CXX executable pfs_connect_attr-t

../../../sql/libsql.a(handler.cc.o): In function `get_ha_partition(partition_info*)':

/root/mysql-5.6.37/sql/handler.cc:460: undefined reference to `ha_partition::ha_partition(handlerton*, partition_info*)'

/root/mysql-5.6.37/sql/handler.cc:462: undefined reference to `ha_partition::initialize_partition(st_mem_root*)'

../../../sql/libsql.a(sql_partition_admin.cc.o): In function `Sql_cmd_alter_table_truncate_partition::execute(THD*)':

/root/mysql-5.6.37/sql/sql_partition_admin.cc:822: undefined reference to `ha_partition::truncate_partition(Alter_info*, bool*)'

collect2: ld returned 1 exit status

make[2]: *** [storage/perfschema/unittest/pfs_connect_attr-t] Error 1

make[1]: *** [storage/perfschema/unittest/CMakeFiles/pfs_connect_attr-t.dir/all] Error 2

make: *** [all] Error 2

 

原因:-DWITHOUT_PARTITION_STORAGE_ENGINE=1

解决方法:-DWITHOUT_PARTITION_STORAGE_ENGINE=0

 

[root@localhost mysql-5.6.37]# /etc/init.d/mysqld start

Starting MySQL.Logging to '/application/mysql-5.6.37/data/localhost.localdomain.err'.

171028 15:38:23 mysqld_safe Directory '/application/mysql-5.6.37/tmp' for UNIX socket file don't exists.

The server quit without updating PID file (/application/mysql-5.6.37/data/localhost.localdomain.pid).[FAILED]

 

解决方法:修改mysql安装目录权限为mysql

#mkdir /application/mysql-5.6.37/tmp

# chmod -R 777 tmp

 

8、 mysql初始安全优化

5.1)删除test数据库

5.2)删除无用的用户,如mysql.user表中的一些无用用户。

转载于:https://www.cnblogs.com/freeeagle/p/8017036.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值