没有合适的资源?快使用搜索试试~ 我知道了~
(免编译版)linux系统mysql安装配置优化手册V2.1.docx
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 20 浏览量
2022-01-08
11:19:07
上传
评论
收藏 22KB DOCX 举报
温馨提示
试读
13页
(免编译版)linux系统mysql安装配置优化手册V2.1.docx
资源推荐
资源详情
资源评论
(免编译版)linux 系统 mysql 安装配置优化手册 V2.1
1.
适用的安装包
1.1 mysql-5.1.48-linux-x86_64-glibc23.tar.gz(64 位)
Version: 2.1
Author: reed
Time: 2012-05-14
1.2 安装 mysql-5.1.48 的 32 位版本请参考《(编译版)linux 系统 mysql 安装配置
优化手册 V2.0》
1.3 mysql-5.0.41-linux-i686-glibc23.tar.gz(32 位)
注:本次安装的 linux 系统环境为 64 位(查看版本:#uname -m) ,则 mysql
也 对应要 64 位。
2.
建立 mysql
需要的用户和组
2.1 #groupadd mysql
2.2 #useradd –g mysql mysql –s /sbin/nologin(–s /sbin/nologin 参数为设置不允许
mysql 用户进行系统登录)
3.
解压缩
# cd /usr/local
# tar -xzvf mysql-5.1.48-linux-x86_64-glibc23.tar.gz
# ln -s /usr/local/mysql-5.1.48-linux-x86_64-glibc23 mysql
4.
生成系统数据库
#cd /usr/local/mysql
# scripts/mysql_install_db --user=mysql
5.
修改 mysql 目录权限
# chown -R root /usr/local/mysql
# chgrp -R mysql /usr/local/mysql
# chown -R mysql /usr/local/mysql/data
注:操作 mysql
数据库的用户是 mysql
所以要拥有数据库目录的所有权
6.
修改配置文件
把配置文件复制到/etc 下
# cp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf
注:
≤如果你的内存 64M ,则复制 my-small.cnf 为/etc/my.cnf
如果内存是 128M ,则复制 my-medium.cnf 为/etc/my.cnf
如果内存是 512M ,则复制 my-large.cnf 为/etc/my.cnf
如果内存是 1-2G ,则复制 my-huge.cnf 为/etc/my.cnf
如果内存是 4G ,则复制 my-innodb-heavy-4G.cnf 为/etc/my.cnf
7.
设置 mysql 中文编码问题
注:这一步在创建用户数据库之前完成,并要重启 MYSQL
#vi /etc/my.cnf
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
#添加的内容
default-character-set=gb2312
[mysqld]
port = 3306
socket = /tmp/mysql.sock
#添加的内容
default-character-set=utf8
8.
设置 Mysql 执行程序的 path 环境变量
#vi /etc/profile
在最后处添加:
PATH=$PATH:/usr/local/mysql/bin
export PATH
保存退出。
#source /etc/profile
9.
设置随系统开机启动
9.1 启动 mysql,如果一切正常的话,运行此命令后,不会有错误提示
#/usr/local/mysql/bin/mysqld_safe --user=mysql &
注:在 Unix 和 NetWare 中推荐使用 mysqld_safe 来启动 mysqld 服务
器。mysqld_safe 增加了一些安全特性,例如当出现错误时重启服务器并向错
误日志文件写入运行时间信息。
9.2 将 mysql.server 这个文件 copy 到/etc/init.d/ 目录下,并更名为 mysql
#cp support-files/mysql.server /etc/init.d/mysql
9.3 给/etc/init.d/mysql “ ”这个文件赋予 执行 权限
#chmod 755 /etc/init.d/mysql
9.4 加入到开机自动运行,运行级别为 3 4 5
#chkconfig --level 345 mysql on
9.5 重启 mysql 服务
#ps
–ef|grep mysql
#kill -9 id
#service mysql start
“注:如果这里启动失败报错,类似这样的错误信息 Starting MySQL.Manager
of pid-file quit without updating file.[ 失败]” ,不要担心,先看下 mysql 的日志
究竟报了什么错,#vi /usr/local/mysql/data/*.err(星号表示你主机的名字),
错误的日志如下:
InnoDB: Error: data file ./ibdata1 is of a different size
InnoDB: 640 pages (rounded down to MB)
InnoDB: than specified in the .cnf file 64000 pages!
InnoDB: Could not open or create data files.
InnoDB: If you tried to add new data files, and it failed here,
InnoDB: you should now edit innodb_data_file_path in my.cnf back
InnoDB: to what it was, and remove the new ibdata files InnoDB created
InnoDB: in this failed attempt. InnoDB only wrote those files full of
InnoDB: zeros, but did not yet use them in any way. But be careful: do not
剩余12页未读,继续阅读
资源评论
进击的朱亚文
- 粉丝: 0
- 资源: 4万+
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功