centos mysql-5.5.20_mysql-5.5.20+CentOS 6.2 编译安装全过程详解(2)

十二、查看端口、测试、应用 Mysql:

netstat -nat

mysql -uroot -p

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

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

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

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

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

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

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

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

至此,可以使用MYSQL了,如果需要开放3306端口,则:

CENTOS打开3306端口:

加入#/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

保存#/etc/rc.d/init.d/iptables save

查看打开的端口# /etc/init.d/iptables status 【或#service iptables status】

********************************************************************************

附1:my.cnf配置参考:

********************************************************************************

# 优化 Mysql 配置文件

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

#

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

# MySQL.

# .............略掉注释

[client]

#password = your_password

port = 3306

socket = /usr/local/mysql/mysql.sock

# Here follows entries for some specific programs

# The MySQL server

[mysqld]

port = 3306

socket = /usr/local/mysql/mysql.sock

datadir=/mysqldata

basedir=/usr/local/mysql

skip-name-resolve #此参数务必加,否则远程连接会很慢。

skip-external-locking

key_buffer_size = 4096M

max_allowed_packet = 2M

table_open_cache = 1024

sort_buffer_size = 2M

read_buffer_size = 32M

read_rnd_buffer_size = 32M

myisam_sort_buffer_size = 128M

thread_cache_size = 64

query_cache_size = 128M

lower_case_table_names = 1

skip-name-resolve

max_connections = 1024

character-set-server = utf8

collation-server = utf8_general_ci

# Try number of CPU's*2 for thread_concurrency

thread_concurrency = 8

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

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

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

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

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

#

#skip-networking

# Replication Master Server (default)

# binary logging is required for replication

log-bin=mysql-bin

expire_logs_days = 10

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

# defaults to 1 if master-host is not set

# but will not function as a master if omitted

server-id = 1

# 以下这些参数可开启。如果应用程序要用到innodb表的话。

# Uncomment the following if you are using InnoDB tables

#innodb_data_home_dir = /usr/local/mysql/data

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

#innodb_log_group_home_dir = /usr/local/mysql/data

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

# of RAM but beware of setting memory usage too high

#innodb_buffer_pool_size = 384M

#innodb_additional_mem_pool_size = 20M

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

#innodb_log_file_size = 100M

#innodb_log_buffer_size = 8M

#innodb_flush_log_at_trx_commit = 1

#innodb_lock_wait_timeout = 50

[mysqldump]

quick

max_allowed_packet = 32M

[mysql]

no-auto-rehash

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

#safe-updates

[myisamchk]

key_buffer_size = 1024M

sort_buffer_size = 512M

read_buffer = 32M

write_buffer = 64M

[mysqlhotcopy]

interactive-timeout

****************************************************************************

附2:可能出现的错误:

****************************************************************************

0、make编译过程中,如出现“警告:提领类型双关的指针将破坏强重叠规则”错误,可以忽略。

#以下错误在centos6.2(已配置好gcc)不会出现。主要是针对centOS5.6之类的系统:

1、错误:Could NOT find Curses

先删除掉CMakeCache.txt ,再yum install ncurses-devel即可。

[root@localhost mysql-5.5.20]# rm CMakeCache.txt

2:出现如下错误:

/usr/local/src/mysql-5.5.20/sql/mysqld.cc: In function ‘void handle_connections_sockets()’:

/usr/local/src/mysql-5.5.20/sql/mysqld.cc:5131: 错误:从类型 ‘size_socket*’ 到类型 ‘socklen_t*’ 的转换无效

/usr/local/src/mysql-5.5.20/sql/mysqld.cc:5131: 错误: 初始化实参 3,属于 ‘int accept(int, sockaddr*, socklen_t*)’

/usr/local/src/mysql-5.5.20/sql/mysqld.cc:5198: 错误:从类型 ‘int*’ 到类型 ‘socklen_t*’ 的转换无效

/usr/local/src/mysql-5.5.20/sql/mysqld.cc:5198: 错误: 初始化实参 3,属于 ‘int getsockname(int, sockaddr*, socklen_t*)’

make[2]: *** [sql/CMakeFiles/sql.dir/mysqld.cc.o] 错误 1

make[1]: *** [sql/CMakeFiles/sql.dir/all] 错误 2

make: *** [all] 错误 2

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

这个是gcc的版本问题,

安装GCC4.4.6【镜像站点gcc-4.6.2编译时有问题】

1.对gcc-4.4.6.tar.gz解压configure,configure出错,需要安装3个依赖包gmp、mpfr和MPC。

由于MPFR依赖GMP,而MPC依赖GMP和MPFR,所以要先安装GMP,其次MPFR,最后才是MPC。

gcc版本太旧会出现:msqld.cc.o错误,安装最新版http://gcc-uk.internet.bs/releases/【镜像站点gcc-4.6.2编译时有问题,因此不建议用更新的版本4.6.2】,

【注:centOS6.2不需要再安装GCC以及以下3个软件了】

1、 GMP,下载:http://gmplib.org/

2、 MPFR:下载:http://www.mpfr.org/mpfr-3.0.0/mpfr-3.0.0.tar.bz2

3、 MPC 0.9【0.8.1不行】下载:http://www.multiprecision.org/?prog=mpc&page=download

详细安装GCC参http://hi.baidu.com/traindiy/blog/item/0ad6cc5cfb26645cfaf2c05e.html

1.1安装GMP

gmp安装gmp-4.3.2.tar.gz

./configure --prefix=/usr/local/gmp

make

make install

1.2安装MPFR

MPFR安装mpfr-3.0.0.tar.bz2

注意configure时候,加入

./configure --with-gmp=/usr/local/gmp --prefix=/usr/local/mpfr,因为mpfr需要gmp。

1.3安装MPC:

./configure --prefix=/usr/local/mpc --with-gmp=/usr/local/gmp --with-mpfr=/usr/local/mpfr

2.解压后目录gcc-4.4.6,具体安装参http://hi.baidu.com/traindiy/blog/item/0ad6cc5cfb26645cfaf2c05e.html

注意:如果需要把/usr/local/lib路径加入到/etc/ld.so.conf中。进一步执行ldconfig.

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值