Chinaunix首页 | 论坛 | 博客
  • 博客访问: 378487
  • 博文数量: 190
  • 博客积分: 50
  • 博客等级: 民兵
  • 技术积分: 125
  • 用 户 组: 普通用户
  • 注册时间: 2013-01-12 14:05
文章分类

全部博文(190)

文章存档

2013年(190)

我的朋友

分类: Mysql/postgreSQL

2013-05-14 14:20:54

最近phpwind升级8.7后,经常出现宕机的现象,不是Apache卡死,吃光内存机器重启,就是mysql数据库被锁,无奈!
多个原因,apache的版本过低,导致执行效率慢;另外数据库版本过低,查询语句多时,自动锁!网站几乎不能访问!另外就是程序可能也有点问题,测试页面可以正常访问!主页却不能打开!

把apache升级到2.2版本,程序转移到了另一台机器上,搭建LAMP环境,用于编译php, 已经安装好了mysql!  试着运行,发现机器运行正常,无负载超高的现象,可是网站还是会卡,数据库还是会锁死!

联系到phpwind官方寻找技术支持,的确有bug,官方同意帮我们解决!

我们也考虑到把数据版本也升级下,由于机器暂时紧缺,只能在程序上搭建,一条船上前线,哈哈!

采用二进制文件安装mysql

初始化正常,添加mysql服务,可是启动的时候出现问题了

[root@localhost scripts]# /usr/local/mysql5.0.45/bin/mysqld_safe --defaults-file=/etc/my.cnf  --user=mysql  &
[1] 31358
[root@localhost scripts]# The file /usr/local/mysql/bin/mysqld doesn't exist or is not executable
Please do a cd to the mysql installation directory and restart
this script from there as follows:
./bin/mysqld_safe.
See http://dev.mysql.com/doc/mysql/en/mysqld_safe.html for more
information
\
[1]+  Exit 1                  /usr/local/mysql5.0.45/bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql


查看了很多资料,最终还是官方的文档给力:

5. Change location into the installation directory:

          shell> cd mysql

     You will find several files and subdirectories in the `mysql'
     directory. The most important for installation purposes are the
     `bin' and `scripts' subdirectories:

        * The `bin' directory contains client programs and the server.
          You should add the full pathname of this directory to your
          `PATH' environment variable so that your shell finds the MySQL
          programs properly. See *Note environment-variables::.

        * The `scripts' directory contains the `mysql_install_db'
          script used to initialize the `mysql' database containing the
          grant tables that store the server access permissions.

  6. Ensure that the distribution contents are accessible to `mysql'.
     If you unpacked the distribution as `mysql', no further action is
     required. If you unpacked the distribution as `root', its contents
     will be owned by `root'. Change its ownership to `mysql' by
     executing the following commands as `root' in the installation
     directory:

          shell> chown -R mysql .
          shell> chgrp -R mysql .

     The first command changes the owner attribute of the files to the
     `mysql' user. The second changes the group attribute to the
     `mysql' group.

  7. If you have not installed MySQL before, you must create the MySQL
     data directory and initialize the grant tables:

          shell> scripts/mysql_install_db --user=mysql

     If you run the command as `root', include the `--user' option as
     shown. If you run the command while logged in as that user, you
     can omit the `--user' option.

     The command should create the data directory and its contents with
     `mysql' as the owner.

     After creating or updating the grant tables, you need to restart
     the server manually.

  8. Most of the MySQL installation can be owned by `root' if you like.
     The exception is that the data directory must be owned by `mysql'.
     To accomplish this, run the following commands as `root' in the
     installation directory:

          shell> chown -R root .
          shell> chown -R mysql data

  9. If you want MySQL to start automatically when you boot your
     machine, you can copy `support-files/mysql.server' to the location
     where your system has its startup files. More information can be
     found in the `support-files/mysql.server' script itself and in
     *Note automatic-start::.


我之前执行的是   chown -R mysql:mysql  .

官方: shell> chown -R root .
           shell> chown -R mysql data

最后修正重启:
[root@localhost mysql5.0.45]# chown -R root .
[root@localhost mysql5.0.45]# chown -R mysql data
[root@localhost mysql5.0.45]# ./bin/mysqld_safe --user=mysql &
[1] 31480
[root@localhost mysql5.0.45]# Starting mysqld daemon with databases from /mysqldata

关闭重启:
[root@localhost mysql5.0.45]# /usr/local/mysql5.0.45/bin/mysqladmin  -u root  shutdown
STOPPING server from pid file /mysqldata/localhost.localdomain.pid
110928 10:49:34  mysqld ended

[1]+  Done                    ./bin/mysqld_safe --user=mysql
[root@localhost mysql5.0.45]# ./bin/mysqld_safe --user=mysql &
[1] 31654
[root@localhost mysql5.0.45]# Starting mysqld daemon with databases from /mysqldata

正常!ok

阅读(1138) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~