mysql 5.6.23 源码包安装报错_Mysql-5.6-快速安装

安装MYSQL

本人安装的系统版本信息(Esxi虚拟机)

[lsug@172-16-1-105 ~]$ uname -a

Linux 172-16-1-105 2.6.32-573.el6.x86_64 #1 SMP Thu Jul 23 15:44:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

[lsug@172-16-1-105 ~]$ cat /etc/redhat-release

CentOS release 6.7 (Final)

一,编译安装所需的工具和库

yum install gcc gcc-c++ ncurses-devel perl cmake  -y

二,新增mysql用户和组

useradd mysql -s /sbin/nologin -M

三,下载软件并安装

下载

wget http://ftp.ntu.edu.tw/MySQL/Downloads/MySQL-5.6/mysql-5.6.34.tar.gz

解压

tar -zxf mysql-5.6.34.tar.gz

cd mysql-5.6.34

编译

cmake . -DCMAKE_INSTALL_PREFIX=/data/mysql \

-DMYSQL_DATADIR=/data/mysql/data \

-DMYSQL_UNIX_ADDR=/data/mysql/tmp/mysql.sock \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLIATION=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 \

-DWITH_FAST_MUTEXES=1 \

-DWITH_ZLIB=bundled \

-DENABLED_LOCAL_INFILE=1 \

-DWITH_READLINE=1 \

-DWITH_EMBEDDED_SERVER=1 \

-DWITH_DEBUG=0

make  && make install

编译my.cnf(这是我们的开发测试环境配置的参数,你可以根据自己的环境调试)

vim /etc/my.cnf

[mysqld]

port            = 3306

socket          = /data/mysql/tmp/mysql.sock

datadir         = /data/mysql/data

user            = mysql

server_id=38253

replicate_wild_ignore_table     = db_check.%

replicate_wild_ignore_table     = information_schema.%

replicate_wild_ignore_table     = performance_schema.%

back_log = 500

max_connections = 4500

max_user_connections = 3000

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

max_connect_errors = 50000

#character_set_filesystem = utf8

collation_server = utf8_bin

character_set_server = utf8

interactive_timeout = 31536000

wait_timeout = 50400

skip_name_resolve = 1

innodb_file_per_table = 1

table_open_cache = 4096

table_definition_cache = 4096

max_allowed_packet = 16M

#binlog_cache_size = 2M

#binlog_stmt_cache_size = 1M

#binlog_rows_query_log_events = 1

max_heap_table_size = 64M

tmp_table_size = 64M

read_buffer_size = 2M

read_rnd_buffer_size = 8M

sort_buffer_size = 2M

join_buffer_size = 2M

thread_cache_size = 64

####thread_concurrency = 16

thread_stack = 256K

#query_cache_size = 64M

#query_cache_type = 0

#query_cache_limit = 2M

ft_min_word_len = 4

default-storage-engine = INNODB

transaction_isolation = REPEATABLE-READ

#log-bin = /data/mysql/data/binlog

#relay_log = /data/mysql/data/relaylog

binlog_format = row

expire_logs_days = 30

log_slave_updates

slow_query_log

long_query_time = 1

key_buffer_size = 32M

bulk_insert_buffer_size = 64M

myisam_sort_buffer_size = 128M

myisam_max_sort_file_size = 10G

myisam_repair_threads = 1

myisam_recover

#innodb_additional_mem_pool_size = 16M

innodb_buffer_pool_size = 32G

innodb_data_file_path = ibdata1:1G:autoextend

#innodb_write_io_threads = 4

#innodb_read_io_threads = 2

#innodb_thread_concurrency = 8

innodb_thread_concurrency = 64

innodb_flush_log_at_trx_commit = 0

#sync_binlog = 0

innodb_log_buffer_size = 8M

innodb_log_file_size = 512M

innodb_log_files_in_group = 3

innodb_max_dirty_pages_pct = 75

innodb_lock_wait_timeout = 10

innodb_old_blocks_time= 1000

innodb_stats_on_metadata = 0

tmpdir = /data/mysql/tmp

#thread_pool_oversubscribe = 8

#slave_parallel_threads = 8

#innodb_buffer_pool_instances = 4

innodb_buffer_pool_dump_at_shutdown = 1

innodb_buffer_pool_load_at_startup = 1

####extra_max_connections = 10

####extra_port = 33061

innodb_print_all_deadlocks = 1

#innodb_io_capacity = 4000

innodb_io_capacity = 2000

#innodb_flush_method = O_DIRECT

innodb_file_format = Barracuda

#innodb_flush_neighbors = 0

#innodb_lru_scan_depth = 2048

#slave-skip-errors=1062

explicit_defaults_for_timestamp=1

[mysqldump]

quick

max_allowed_packet = 16M

[mysql]

no-auto-rehash

prompt="\\u@\\h:\\d \\R:\\m:\\s> "

default-character-set = utf8

[myisamchk]

key_buffer_size = 512M

sort_buffer_size = 512M

read_buffer = 8M

write_buffer = 8M

[mysqlhotcopy]

interactive-timeout

[mysqld_safe]

open-files-limit = 8192

--------------------------

mkdir -p /data/mysql/tmp/

修改权限文件

chown -R mysql.mysql /data/mysql

进入安装路径,执行初始化配置脚本

cd /data/mysql

./scripts/mysql_install_db --user=mysql --basedir=/data/mysql --datadir=/data/mysql/data/

注:在启动MySQL服务时,会按照一定次序搜索my.cnf,

先在/etc目录下找,找不到则会搜索"$basedir/my.cnf",

在本例中就是,本人放置在/etc/my.cnf

注意:在CentOS 6.4版操作系统的最小安装完成后,在/etc目录下会存在一个my.cnf,需要将此文件更名为其他的名字,如:/etc/my.cnf.bak,否则,该文件会干扰源码安装的MySQL的正确配置,造成无法启动。

添加服务,拷贝服务脚本到init.d目录,并设置开机启动

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

chkconfig mysql on

启动msyql并检查状态

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

Starting MySQL........ SUCCESS!

[root@localhost mysql]# /etc/init.d/mysql status

SUCCESS! MySQL running (32356)

MySQL启动成功后,root默认没有密码,我们需要设置root密码。

设置之前,我们需要先设置PATH,要不然不能直接调用mysql

修改/etc/profile文件,在文件末尾添加

export PATH=/data/mysql/bin:$PATH

让配置立即生效

source /etc/profile

现在,我们可以在终端内直接输入mysql,进入mysql的环境了

执行下面的命令修改root密码

mysql -uroot

mysql> SET PASSWORD = PASSWORD('123456');

若要设置root用户可以远程访问,执行

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

-----------编译报错解决------(网上搜集)----------

1.若make出现类似错误:

CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".

CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.

表明make未安装,执行:sudo apt-get install -y make

参见: Mysql 错误以及解决办法

2.如果make到63%左右出现错误:

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

则:cmake去掉-DWITH_PARTITION_STORAGE_ENGINE=1参数重新编译

参见: 通用MYSQL5.5和5.6源码包安装

3.MySQL启动报错:

[ERROR] InnoDB: The system tablespace must be writable!

[ERROR] Plugin 'InnoDB' init function returned error.

则:rm -rf /usr/local/mysql/data/ib_logfile*

编译参数及安装过程: Linux源码安装mysql 5.6.12 (cmake编译)

4.其他错误: Ubuntu 12 下的Mysql 5.5的 cmake 源码编译安装

5.编译错误:configure: error: No curses/termcap library found

查找文件系统:find / -name libncursesw*

如果找到则重新编译并加上以下参数:

--with-named-curses-libs=/lib/i386-linux-gnu/libncursesw.so.5.9

或者安装libncurses5-dev包:

sudo apt-cache search libncurses5 && sudo apt-get install -y libncurses5-dev

6.make出现错误:collect2: ld returned 1 exit status

尝试如下解决方案:

sudo apt-get install -f

sudo apt-get update

sudo apt-get dist-upgrade

sudo apt-get install -f build-essential libncurses5-dev libncurses5

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值