Chinaunix

标题: Linux下配置mysql,集群等.... [打印本页]

作者: ClearWind    时间: 2008-08-25 10:17
标题: Linux下配置mysql,集群等....

#======================================== 安装前的准备 ========================================
# 关闭防火墙
chkconfig --del iptables
service iptables stop
# 下载解压包 解压
cd /usr/local
wget -d http://192.168.1.180/linuxfile/mysql6.0_NoCompilingSmall.zip
unzip mysql6.0_NoCompilingSmall.zip
rm -rf mysql6.0_NoCompilingSmall.zip
chown -R root:root .
chmod -R 777 .
mv mysql6.0_NoCompilingSmall mysql
#======================================== 开始安装 ========================================
# 开机启动mysql
cd mysql
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 777 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 35 mysqld on
# cp support-files/mysql.server /etc/init.d/mysqld
# chmod 777 /etc/init.d/mysqld
cp support-files/my-medium.cnf /etc/my.cnf
chown mysql:mysql /etc/my.cnf
chmod 777 /etc/my.cnf
# 添加mysql用户及用户组
groupadd mysql
useradd -g mysql mysql
# 修改mysql目录权限
chown -R mysql:root .
chown -R mysql data
# 生成mysql系统数据库
# 启动mysql服务 如出现 Starting mysqld daemon with databases from /usr/local/mysql/data 代表正常启动mysql服务了
chmod -R 777 .
scripts/mysql_install_db
chmod -R 777 .
bin/mysqld_safe --user=mysql &
#========================================  添加远程用户 ========================================
# 登录 添加远程用户 刷新权限
/usr/local/mysql/bin/mysql -h localhost -u root -p
grant all privileges on test.* to root@'localhost' identified by "root" with grant option;
grant all privileges on test.* to root@'%' identified by "root" with grant option;
FLUSH PRIVILEGES;
#========================================  Linux相关操作 ========================================
网络 防火墙 SSH的打开 文件权限 开机启动服务的添加
1.RedHat AS 5 的安装选项.
    桌面环境:不装                        // 不要装
    应用程序:编辑器(vi)                    // 可以不装,但少了VI的话就连基本的文本编辑器都没有了
    开发:开发工具(考虑只装GCC)、开发库    // 这东西最重要了
    服务器:不装                            // 可以不装,可以后再装
    基本系统:基本                        // 基本不能少,否则可能连网卡都不能用
2.RedHat AS 5 的防火墙操作.
    停止防火墙      service iptables stop
    启动防火墙      service iptables start
    查看防火墙配置    iptables -L -n
    关闭防火墙开机启动 chkconfig --del iptables
3.SSH的配置.
    开启SSH服务        service sshd start
                    /etc/init.d/sshd start
    重启SSH服务        /etc/init.d/sshd restart
    配置SSH服务        /etc/ssh/sshd_config
4.端口的操作(防火墙配置).
    # 打开3306端口
    vi /etc/sysconfig/iptables 添加一行:-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
5.查看系统配置或资源使用情况.
    top    # 查看CPU,内存使用率等
    netstat -atln    查看系统所打开的端口
6.MySql命令行操作.
    GRANT语法 : GRANT 权限 ON 库名.表名 TO 用户名@主机名 IDENTIFIED BY "密码";
7.


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/22697/showart_1146327.html




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2