MySQL 从5.5开始改用cmake来编译源码,本例为编译源码安装 mysql :

# 添加 Mysql 帐号

useradd mysql -s /sbin/nologin

#创建文件夹

mkdir -p /usr/local/mysql #存放mysql路径

mkdir -p /usr/local/mysqldb #存放数据库文件路径,具体路径可根据需要自行创建

chown mysql:mysql /usr/local/mysqldb #设置访问权限

# 安装编译软件

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

wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.15.tar.gz

# 安装 Mysql

1 tar zxvf mysql-5.6.15.tar.gz

2 cd mysql-5.6.15

3 cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysqldb -DSYSCONFDIR=/etc -DDEFAULT_CHARSET=utf8 -DMYSQL_USER=mysql -DDEFAULT_COLLATION=utf8_general_ci

4 make -j2

5 make install

# 初始化 Mysql

cd /usr/local/mysql

1 cp ./support-files/my-default.cnf /etc/my.cnf  #复制配置文件,如果存在覆盖即可

2 cp ./support-files/mysql.server /etc/init.d/mysqld      #可用service命令重启

3 chmod 755 /etc/init.d/mysqld                             #权限设定为755

4 chkconfig --level 35 mysqld on                            #增加 mysql 自动启动级别

5 ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysqldb                          #创建系统数据库

6 vi /etc/profile                   #将mysql服务加入到系统变量,在最后一行添加

export PATH=$PATH:/usr/local/mysql/bin

7 vi /etc/rc.d/init.d/mysqld

basedir=/usr/local/mysql     #mysql安装路径

datadir=/usr/local/mysqldb  #mysql数据库存放路径

8 reboot       #重启服务器

9 mysql_secure_installation #设置mysql密码或直接修改密码

mysqladmin -u root -p password "123456"  #设置密码

10 service mysqld restart  #重启服务

mysql安装完成

# 优化 Mysql 配置文件

1 # 以4核cpu 8G内存 的硬件配置来优化参数: vim /etc/my.cnf

2 #

3 # This is for a large system with memory of 1G-2G where the system runs mainly

4 # MySQL.

5 #

6 # MySQL programs look for option files in a set of

7 # locations which depend on the deployment platform.

8 # You can copy this option file to one of those

9 # locations. For information about these locations, see:

11 #

12 # In this file, you can use all long options that a program supports.

13 # If you want to know which options a program supports, run the program

14 # with the "--help" option.

15

16 # The following options will be passed to all MySQL clients

17 [client]

18 #password       = your_password

19 port            = 3306

20 socket          = /tmp/mysql.sock

21

22 # Here follows entries for some specific programs

23 # The MySQL server

24 [mysqld]

25 port            = 3306

26 socket          = /tmp/mysql.sock

27 skip-external-locking

28 key_buffer_size = 4096M

29 max_allowed_packet = 2M

30 table_open_cache = 1024

31 sort_buffer_size = 2M

32 read_buffer_size = 32M

33 read_rnd_buffer_size = 32M

34 myisam_sort_buffer_size = 128M

35 thread_cache_size = 64

36 query_cache_size = 128M

37 datadir=/usr/local/mysql/data

38 lower_case_table_names = 1

39 skip-name-resolve

40 max_connections = 1024

41 character-set-server = utf8

42 collation-server = utf8_general_ci

43 # Try number of CPU's*2 for thread_concurrency

44 thread_concurrency = 8

45

46 # Don't listen on a TCP/IP port at all. This can be a security enhancement,

47 # if all processes that need to connect to mysqld run on the same host.

48 # All interaction with mysqld must be made via Unix sockets or named pipes.

49 # Note that using this option without enabling named pipes on Windows

50 # (via the "enable-named-pipe" option) will render mysqld useless!

51 #

52 #skip-networking

53

54 # Replication Master Server (default)

55 # binary logging is required for replication

56 log-bin=mysql-bin

57 expire_logs_days = 10

58

59 # required unique id between 1 and 2^32 - 1

60 # defaults to 1 if master-host is not set

61 # but will not function as a master if omitted

62 server-id = 1

63

64 # Replication Slave (comment out master section to use this)

65 #

66 # To configure this host as a replication slave, you can choose between

67 # two methods :

68 #

69 # 1) Use the CHANGE MASTER TO command (fully described in our manual) -

70 #    the syntax is:

71 #

72 #    CHANGE MASTER TO MASTER_HOST=, MASTER_PORT=,

73 #    MASTER_USER=, MASTER_PASSWORD= ;

74 #

75 #    where you replace , , by quoted strings and

76 #     by the master's port number (3306 by default).

77 #

78 #    Example:

79 #

80 #    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,

81 #    MASTER_USER='joe', MASTER_PASSWORD='secret';

82 #

83 # OR

84 #

85 # 2) Set the variables below. However, in case you choose this method, then

86 #    start replication for the first time (even unsuccessfully, for example

87 #    if you mistyped the password in master-password and the slave fails to

88 #    connect), the slave will create a master.info file, and any later

89 #    change in this file to the variables' values below will be ignored and

90 #    overridden by the content of the master.info file, unless you shutdown

91 #    the slave server, delete master.info and restart the slaver server.

92 #    For that reason, you may want to leave the lines below untouched

93 #    (commented) and instead use CHANGE MASTER TO (see above)

94 #

95 # required unique id between 2 and 2^32 - 1

96 # (and different from the master)

97 # defaults to 2 if master-host is set

98 # but will not function as a slave if omitted

99 #server-id       = 2

100 #

101 # The replication master for this slave - required

102 #master-host     =

103 #

104 # The username the slave will use for authentication when connecting

105 # to the master - required

106 #master-user     =

107 #

108 # The password the slave will authenticate with when connecting to

109 # the master - required

110 #master-password =

111 #

112 # The port the master is listening on.

113 # optional - defaults to 3306

114 #master-port     =

115 #

116 # binary logging - not required for slaves, but recommended

117 #log-bin=mysql-bin

118 #

119 # binary logging format - mixed recommended

120 #binlog_format=mixed

121

122 # Uncomment the following if you are using InnoDB tables

123 #innodb_data_home_dir = /usr/local/mysql/data

124 #innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend

125 #innodb_log_group_home_dir = /usr/local/mysql/data

126 # You can set .._buffer_pool_size up to 50 - 80 %

127 # of RAM but beware of setting memory usage too high

128 #innodb_buffer_pool_size = 384M

129 #innodb_additional_mem_pool_size = 20M

130 # Set .._log_file_size to 25 % of buffer pool size

131 #innodb_log_file_size = 100M

132 #innodb_log_buffer_size = 8M

133 #innodb_flush_log_at_trx_commit = 1

134 #innodb_lock_wait_timeout = 50

135

136 [mysqldump]

137 quick

138 max_allowed_packet = 32M

139

140 [mysql]

141 no-auto-rehash

142 # Remove the next comment character if you are not familiar with SQL

143 #safe-updates

144

145 [myisamchk]

146 key_buffer_size = 1024M

147 sort_buffer_size = 512M

148 read_buffer = 32M

149 write_buffer = 64M

150

151 [mysqlhotcopy]

152 interactive-timeout

# 启动 Mysql

1 cd /usr/local/mysql/bin

2 ./mysqld_safe –defaults-file=/etc/my.cnf --user=mysql &

# 应用 Mysql

1 /usr/local/mysql/bin/mysql -uroot

2

3 mysql> show processlist;                    -- 查看当前正在执行的任务

4 mysql> show variables;                      -- 查看系统变量

5 mysql> show variables like 'max%';          -- 查看max开头的系统变量

6 mysql> show status;                         -- 查看当前系统状态

7 mysql> show status like 'qcache%';          -- 查看与qcache相关的系统状态

8 mysql> show status like 'max%';             -- 查看与max相关的系统状态

9 mysql> show master status;                  -- 查看主从关系中主服务器状态

10 mysql> show slave status;                   -- 查看主从关系中从服务器状态

mysql5.6编译_mysql5.6编译安装相关推荐

  1. 指令mysql5.6卸载_Mysql5.6压缩包安装到windows 卸载命令

    1.根目录下有一个my-default.ini,复制一下,重命名为my.ini,然后改一下my.ini为符合你情况的配置,一般只需要改basedir .datadir .port ,注意前边的井号去掉 ...

  2. mysql5.7 cmake源码编译安装

    mysql5.7 cmake源码编译安装, -----该文章的知识点是一个大牛总结的,我这里只是加工了一下,非原创文章. 搜狐开源镜像站:http://mirrors.sohu.com/ 网易开源镜像 ...

  3. cmake 编译mysql_CentOS5.6下使用cmake编译MySQL5.5.13源码和安装

    一.准备环境 1.    安装确保以下系统相关库文件 gcc gcc-c++ autoconf automake zlib* libxml* ncurses-devel libmcrypt* libt ...

  4. mysql5.1编译安装centos7_CentOS7下 Nginx1.13.5 + PHP7.1.10 + MySQL5.7.19 源码编译安装

    在CentOS7下 Nginx1.13.5 + PHP7.1.10 + MySQL5.7.19 源码编译安装过程记录. 一.安装Nginx 1.安装依赖扩展 # yum -y install wget ...

  5. centos 安装mysql5.6.22_centos 7.0 编译 安装mysql 5.6.22 过程 已完成~ 成功~ 撒花~

    mysql 下载目录/usr/local/src mysql 解压目录 /usr/local/bin/mysql GitHub https://github.com/mysql/mysql-serve ...

  6. 编译安装mysql5.6.36_MySQL5.6.36编译安装

    一.MySQL5.6.36安装前准备 (1)克隆一个模板机器(使用centos6),克隆完做快照 (2)IP 10.0.0.52 主机名db02 (3)iptables selinux (4)下载好5 ...

  7. 关于安卓Apk反编译 再编译回来不能正常安装的问题

    使用apktool反编译apk之后,再编译回去,发现不能正常安装,而使用ApkToolKitV3.0反编译,再编译回去就可以正常安装. 主要原因是因为使用apktool编译回没有签名. 所以不能安装, ...

  8. 5.15 vs2019 静态编译_HPCC S01E01 编译 win10,ubuntu 安装

    本文使用 Zhihu On VSCode 创作并发布 首先HPC Challenge的编译需要bash.不能用cmd. ubuntu会自带bash,win10需要另外安装bash,可以使用msys2 ...

  9. mysql编译和yum安装哪个好_Centos7下PHP源码编译和通过yum安装的区别和以后的选择...

    最近在Centos7下配置PHP+Nginx+MySQL,对源码编译和yum编译的两种方法产生好奇.究竟这两种哪一种好? 其实这两种方法各有千秋: 从yum安装来说吧,yum相当于是自动化帮你安装,你 ...

最新文章

  1. redis mysql 集群_mysql_redis
  2. 让vs中网站的sln文件使用相对路径的办法
  3. 转:构建高性能ASP.NET站点 第五章—性能调优综述(中篇)
  4. 【数据库】Ubuntu18.04安装MySQL详解
  5. 使用airdrop进行文件共享
  6. html输入支付密码样式,基于JS实现类似支付宝支付密码输入框
  7. python int转str_用Python生成抖音字符视频!
  8. springboot细节挖掘(知识积累)
  9. oracle 分组 top10 sql,oracle sql 合龙 分组 聚合函数
  10. (寒假集训)Mooo Moo (完全背包)
  11. bzoj 3751: [NOIP2014]解方程(同余系)
  12. GFLOPs、GMACs、FMA之间的关系
  13. android录屏代码(录屏并生成mp4文件)
  14. 小学-知识与能力【9】
  15. 赋能数字化生命力,让企业未来焕发青春
  16. Bash Shellshock(Bash远程代码执行)漏洞分析及利用思路
  17. 一个3D摄像机的设计与实现
  18. 关于Android Launcher3相关优秀文章的记录
  19. 2的1000次方的各位之和是多少?
  20. PL/SQL:DBMS_PIPE包的使用

热门文章

  1. python将大于输出列表_程序检查列表中的所有值是否都大于Python中的给定值
  2. c语言判断字符是否等于e,C语言如何实现删除字符串中的字符
  3. C语言跟随鼠标画方框,JS拖动鼠标画出方框实现鼠标选区的方法
  4. 六十三、SpringBoot中的日志框架SLF4j的使用
  5. pyqt5 中QSS
  6. tornado 模板
  7. GPLinker:基于GlobalPointer的事件联合抽取
  8. 中科院自动化所:最新视觉-语言预训练综述
  9. “神算子”上线!EasyDL时序预测模型零门槛轻松上手
  10. ACL 2021 | 为什么机器阅读理解模型会学习走捷径?