mysql 5.1.73安装

Mysql安装包下载地址:https://downloads.mysql.com/archives/community/

一 安装

1.1 建用户

groupadd mysql

useradd -g mysql mysql 

passwd mysql

1.2 安装依赖包

yum install libaio -y

yum install -y numactl 

1.3 解压

tar -xvf mysql-5.1.73-linux-x86_64-glibc23.tar.gz

cp mysql-5.1.73-linux-x86_64-glibc23  /usr/local/mysql -r

chown -R mysql:mysql /usr/local/mysql

1.4 新建目录

mkdir -p /data/server/mysql/data

mkdir -p /data/server/mysql/binlog

chown -R mysql:mysql /data/server/mysql/

1.5 新建配置文件

cd /etc

mv my.cnf my.cnf_bak

[root@rac1 etc]# cat my.cnf

[mysqld]

basedir=/usr/local/mysql/

datadir=/data/server/mysql/data

log-bin=/data/server/mysql/binlog/mysql-bin

log-bin-index=/data/server/mysql/binlog/binlog.index

server-id=1

port=3306

socket=/tmp/mysql.sock

user=mysql

# Disabling symbolic-links is recommendedto prevent assorted security risks

symbolic-links=0



[mysqld_safe]

log-error=/data/server/mysql/mysqld.err

pid-file=/data/server/mysql/mysqld.pid

1.6 建立基本库

/usr/local/mysql/scripts/mysql_install_db --user=mysql  --basedir=/usr/local/mysql --datadir=/data/server/mysql/data --defaults-file=/etc/my.cnf

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:



/usr/local/mysql/bin/mysqladmin -u root password 'new-password'

/usr/local/mysql/bin/mysqladmin -u root -h rac1 password 'new-password'



Alternatively you can run:

/usr/local/mysql/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 /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &



You can test the MySQL daemon with mysql-test-run.pl

cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl



Please report any problems with the /usr/local/mysql/scripts/mysqlbug script!

1.7 配置环境变量

vi /root/.bash_profile

在PATH=$PATH:$HOME/bin后添加:/usr/local/mysql/bin

source /root/.bash_profile

1.8 启动数据库

mysqld_safe --defaults-file=/etc/my.cnf &

1.9 修改root密码

mysqladmin -u root -p password 新密码

1.10 设置mysql开机自启

cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql

chkconfig --add mysql 

chkconfig mysql on

 

vi /etc/rc.d/init.d/mysql

将datadir=修改为datadir=/data/server/mysql/data

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值