下载地址:http://dev.mysql.com/downloads/cluster/#downloads
版本可能有更新,但是操作不变,注意你的下载名和下载目录不错就行啊。
本例以root权限安装mysql数据库,mysql-5.1.37-linux-x86_64-glibc23.tar.gz安装包在/root/Nagios/
ü
cd
tar -zvxf mysql-5.1.37-linux-x86_64-glibc23.tar.gz
ü
mv mysql-5.1.37-linux-x86_64-glibc23 /usr/local/mysql
ü
cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
ü
groupadd mysql
useradd -g mysql mysql
ü
//
chown -R root /usr/local/mysql
//
chgrp -R mysql /usr/local/mysql
//
chown -R mysql /usr/local/mysql/data
ü
cd /usr/local/mysql
./scripts/mysql_install_db --user=mysql&
ü
/usr/local/mysql/bin/mysqld_safe -user=mysql&
ü
/usr/local/mysql/bin/mysqladmin -u root password 123456
ü
cd /usr/local/mysql/bin
./mysql -u root -p
输入密码:123456
ü
grant all on *.* to root@本机IP
grant all privileges on *.* to root @"%" identified by "123456";
flush privileges;
说明:
grant all privileges on *.* to
all指定相关操作
*.*说明数据库和表名
username表示用户名
%这里是Host名称,允许所有的就用%
Password表示密码
设置MySQL服务及命令
拷贝mysql安装目录下bin/目录中的文件到/usr/bin目录,使mysq等命令可以在任一路径执行:
cp /usr/local/mysql/bin /usr/bin
设置mysql启动命令,打开/usr/local/mysql/support-files/mysql.server文件,将以下内容:
$bindir/safe_mysqld --datadir=$datadir --pid-file=$pid_file &
改为:
$bindir/safe_mysqld --datadir=$datadir --user=root --pid-file=$pid_file &
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
service mysql start
在文件/etc/rc.d/rc.local中添加
service mysql start
数据库初始化
ü
cd /usr/local/mysql/bin
./mysql -u root -p
ü
create database test02 default character set utf8;
ü
/usr/local/mysql/bin/mysql -u root -p -D
ü
ü
use test02;
show tables;