设为首页 收藏本站
查看: 739|回复: 0

[经验分享] centos cmake 安装 mysql-5.5.16 附配置文件

[复制链接]

尚未签到

发表于 2016-5-12 11:57:58 | 显示全部楼层 |阅读模式
mysql从5.5之后源码安装需要使用cmake:

  To install MySQL from source, your system must have the following tools, regardless of installation method:

  •   CMake, which is used as the build framework on all platforms.CMake can be downloaded fromhttp://www.cmake.org.
  •   A good make program. Although some platforms come with their ownmake implementations, it is highly recommended that youuse GNUmake 3.75 or newer. It may already be available on your system asgmake. GNUmake is available fromhttp://www.gnu.org/software/make/.
  •   A working ANSI C++ compiler. GCC 4.2.1 or later, Sun Studio 10 or later, Visual Studio 2008 or later, and many current vendor-supplied compilers are known to work.
  •   Perl is needed if you intend to run test scripts. Most Unix-like systems include Perl. On Windows, you can use a version such as ActiveState Perl.

yum 安装 gcc,gcc-c++,cmake,bison(GNU),使用 centos6.0 自带的perl和openssl添加mysql组和mysql用户


/usr/sbin/groupaddmysql
/usr/sbin/useradd-gmysqlmysql

  
将mysql和data文件安装到不同的物理磁盘上

cmake -DCMAKE_INSTALL_PREFIX=/opt/soft/mysql \
-DMYSQL_DATADIR=/home/soft/mysql/data \
-DMYSQL_UNIX_ADDR=/opt/soft/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DWITH_EMBEDDED_SERVER=0 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_USER=mysql \
-DWITH_DEBUG=0 \
-DWITH_SSL=yes

报错:
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:82 (MESSAGE):
Curses library not found. Please install appropriate package,

  
   remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu , package name is libncurses5-dev ,
   on RedHat and derivates it is ncurses-devel.
Call Stack (most recent call first):
cmake/readline.cmake:126 (FIND_CURSES)
cmake/readline.cmake:216 (MYSQL_USE_BUNDLED_LIBEDIT)
CMakeLists.txt:256 (MYSQL_CHECK_READLINE)

  
-- Configuring incomplete, errors occurred!

=======================没有安装 ncurses-devel
yum安装之后 还是报错,找运维高手才知道 cmake会产生CMakeCache.txt文件,每次cmake之前需要删除它....
ok,一切正常

echo $?
输出结果为0
make
make install
安装成功
chown mysql:mysql /home/soft/mysql -R

chown mysql:mysql /opt/soft/mysql/ -R


初始化数据库
cd /opt/soft/mysql/

/opt/soft/mysql/scripts/mysql_install_db \--defaults-file=/opt/soft/mysql/config/my.cnf \ --basedir=/opt/soft/mysql\ --datadir=/home/soft/mysql/data \ --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h c60h.localdomain password 'new-password'

Alternatively you can run:
./bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl

Please report any problems with the ./bin/mysqlbug script!



===============================
之所以要安装mysql5.5.16是想将Percona-5.5.16中的xtraDB安装到mysql中,替换了storage中的innobase,结果make步骤中报错,只能是单独安装Percona了.
=================================
启动

/opt/soft/mysql/bin/mysqld_safe --defaults-file=/opt/soft/mysql/config/my.cnf --user=mysql &
[1] 25812
# 111031 13:18:55 mysqld_safe Logging to '/home/soft/mysql/data/c60h.localdomain.err'.
111031 13:18:55 mysqld_safe Starting mysqld daemon with databases from /home/soft/mysql/data
^C
# netstat -antp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:50341 0.0.0.0:* LISTEN 1409/rpc.statd
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 26217/mysqld
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1340/rpcbind
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1619/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1121/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1695/master
tcp 0 52 192.168.161.141:22 192.168.161.1:54674 ESTABLISHED 1820/sshd: admin [p
tcp 0 0 :::42759 :::* LISTEN 1409/rpc.statd
tcp 0 0 :::111 :::* LISTEN 1340/rpcbind
tcp 0 0 :::22 :::* LISTEN 1619/sshd
  tcp 0 0 ::1:631 :::* LISTEN 1121/cupsd

  配置mysql用户
/opt/soft/mysql/bin/mysqladmin -u root password 123456
/opt/soft/mysql/bin/mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
/opt/soft/mysql/bin/mysql -p123456
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.5.16-log Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select host,user,password from user;
+------------------+------+-------------------------------------------+
| host | user | password |
+------------------+------+-------------------------------------------+
| localhost | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| c60h.localdomain | root | |
| 127.0.0.1 | root | |
| ::1 | root | |
| localhost | | |
| c60h.localdomain | | |
+------------------+------+-------------------------------------------+
6 rows in set (0.00 sec)

mysql> delete from user where LENGTH(password)<10;
Query OK, 5 rows affected (0.00 sec)

mysql> select host,user,password from user;
+-----------+------+-------------------------------------------+
| host | user | password |
+-----------+------+-------------------------------------------+
| localhost | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
+-----------+------+-------------------------------------------+
1 row in set (0.00 sec)

mysql> grant all on *.* to 'admin'@'192.168.%' identified by '123456';
Query OK, 0 rows affected (0.00 sec)

mysql> select user,host,password from user;
+-------+-----------+-------------------------------------------+
| user | host | password |
+-------+-----------+-------------------------------------------+
| root | localhost | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| admin | 192.168.% | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
+-------+-----------+-------------------------------------------+
2 rows in set (0.00 sec)

  ===================
  root用户只能本机登陆
  admin 只能局域网登陆
  ==============================
  开启 3306 端口

  vi /etc/sysconfig/iptables

  -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
  service iptables restart
  重启 iptables 生效
  ========================
  配置文件
  cat config/my.cnf
[client]
#password = your_password
port = 3306
socket = /opt/soft/mysql/mysql.sock
default-character-set = utf8

[mysql]
default-character-set = utf8

[mysqld]
character-set-server = utf8
datadir = /home/soft/mysql/data
tmpdir = /dev/shm
port = 3306
socket = /opt/soft/mysql/mysql.sock
pid-file = /opt/soft/mysql/601.localdomain.pid
skip-external-locking
key_buffer_size = 16K
max_allowed_packet = 1M
table_open_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 128K

default-storage-engine = innodb
innodb_buffer_pool_size = 128M
innodb_data_home_dir = /home/soft/mysql/data
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /opt/soft/mysql/log
innodb_log_file_size = 512M
innodb_log_files_in_group = 3
innodb_lock_wait_timeout = 60
innodb_flush_log_at_trx_commit = 2

#skip-networking
server-id = 601

log-slave-updates
log-bin = /opt/soft/mysql/binlog/mysql-bin
relay-log = /opt/soft/mysql/binlog/mysql-relay-bin
#binlog_format=mixed

# Causes updates to non-transactional engines using statement format to be
# written directly to binary log. Before using this option make sure that
# there are no dependencies between transactional and non-transactional
# tables such as in the statement INSERT INTO t_myisam SELECT * FROM
# t_innodb; otherwise, slaves may diverge from the master.
#binlog_direct_non_transactional_updates=TRUE

# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /var/lib/mysql
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50

[mysqldump]
quick
max_allowed_packet = 16M

[mysqladmin]
#socket = /home/mysql/data/mysql.sock

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M

[mysqlhotcopy]
interactive-timeout

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-216080-1-1.html 上篇帖子: CentOS 5.3 下源码编译安装Ipmsg 笔记 下篇帖子: 用PXE引导调用kickstart安装CentOS 5
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表