redhat 6.4 mysql_Install MYSQL from source on rhel 6.4

MYSQL安装后设置

在类UNIX系统中安装MYSQL后,必须初始化授权表、启动服务并确认服务工作正常,设置开机服务自启动,关机服务自关闭,对授权表分配密码给账户

在类UNIX系统中,授权表设置使用mysql_install_db程序,有一些安装方法已经自动运行该程序:

rpm 安装方式自动运行

原生包安装在Debian Linux, Ubuntu Linux, Gentoo Linux上,建议运行mysql_install_db(以上安装就是)

OS X 使用DMG版本自动运行mysql_install_db

其他平台的安装方式,包括二进制和源码安装,建议运行mysql_install_db

shell> cd BASEDIR  切换到安装目录

目录下有两个重要bin(需要配置路径)和scripts(mysql_install_db所在)

1:权限设置

如果是使用mysql用户安装不需要进行权限操作,如果是root用户安装进入mysql安装目录:

shell> chown -R mysql .

shell> chgrp -R mysql .

2:执行mysql_install_db

如果是root用户执行,必须加上--user参数

shell> scripts/mysql_install_db --user=mysql

如果需要改变目录:

shell> scripts/mysql_install_db --user=mysql \

--basedir=/opt/mysql/mysql \

--datadir=/opt/mysql/mysql/data

3:建议安装目录为root权限,data目录为mysql

shell> chown -R root .

shell> chown -R mysql data

4:如果使用插件的话SELECT ... INTO DUMPFILE 使用插件plugin_dir 或者在启动文件中使用--secure-file-priv

5:如果你想从 support-files 复制一份标准配置,需要复制到 /etc/my.cnf, or /etc/mysql/my.cnf 进行相关编辑,如果不进行复制,mysql会使用默认配置,如果想配置开机自启动,需要将you can copy support-files/mysql.server to the location where your system has its startup files

6:启动MYSQL 服务

shell> bin/mysqld_safe --user=mysql &

If the command fails immediately and prints mysqld ended, look for information in the error log (which by default is the host_name.err file in the data directory).

If you neglected to create the grant tables by running mysql_install_db before proceeding to this step, the following message appears in the error log file when you start the server:

mysqld: Can't find file: 'host.frm'

This error also occurs if you run mysql_install_db as root without the --user option. Remove the datadirectory and run mysql_install_db with the --user option as described previously.

7:使用mysqladmin确认mysql是否在运行

[root@mysql5 mysql5.6.22]# bin/mysqladmin version

8:关闭mysql服务

shell> bin/mysqladmin -u root shutdown

9:为了确定MYSQL服务能够再次启动,再次执行

shell> bin/mysqld_safe --user=mysql &

10:验证能够查询到服务信息

[root@mysql5 mysql5.6.22]# bin/mysqlshow

+--------------------+

|     Databases      |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| test               |

+--------------------+

11:MYSQL 标准套件

sql-bench

you can use to compare how MySQL performs on different platforms.

-----------------------------------------------------------------------------

以上是官网建议make install后步骤,下面是我的步骤:

[root@mysql5 mysql5.6.22]# cd /u01/mysql5.6.22 切换到MYSQL安装目录

[root@mysql5 mysql5.6.22]# chown -R mysql .

[root@mysql5 mysql5.6.22]# chgrp -R mysql .

[root@mysql5 mysql5.6.22]# scripts/mysql_install_db --user=mysql

[root@mysql5 mysql5.6.22]# chown -R root .

[root@mysql5 mysql5.6.22]# chown -R mysql data

[root@mysql5 mysql5.6.22]# bin/mysqld_safe --user=mysql &

[1] 19332

[root@mysql5 mysql5.6.22]# 150126 06:09:58 mysqld_safe Logging to '/u01/mysql5.6.22/data/mysql5.6.err'.

150126 06:09:58 mysqld_safe Starting mysqld daemon with databases from /u01/mysql5.6.22/data

[root@mysql5 mysql5.6.22]# jobs

[1]+  Running                 bin/mysqld_safe --user=mysql &

[root@mysql5 mysql5.6.22]# ps -ef | grep mysqld 查看是否启动

root     19332  2357  0 06:09 pts/1    00:00:00 /bin/sh bin/mysqld_safe --user=mysql

mysql    19422 19332  0 06:09 pts/1    00:00:00 /u01/mysql5.6.22/bin/mysqld --basedir=/u01/mysql5.6.22 --datadir=/u01/mysql5.6.22/data --plugin-dir=/u01/mysql5.6.22/lib/plugin --user=mysql --log-error=/u01/mysql5.6.22/data/mysql5.6.err --pid-file=/u01/mysql5.6.22/data/mysql5.6.pid

root     19474  2357  0 06:17 pts/1    00:00:00 grep mysqld

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值