您的当前位置:首页正文

mysql安装及磁盘阵列挂载

2024-10-18 来源:威能网
mysql安装及磁盘阵列挂载

Mysql5.6.27安装步骤详解及挂载磁盘阵列 时间同步

ntpdate -u ntp.api.bz 安装环境

# yum -y remove mysql mysql-server cmake

# rm -rf /etc/http://www..com/doc/4f7352792.html,f //安装前删除此文件

# yum -y groupinstall \"Development tools\"

# yum -y install ncurses ncurses-devel openssl-devel bison gcc gcc-c++ make

Cmake:

# tar xvf cmake-2.8.10.2.tar.gz # cd cmake-2.8.10.2 # ./bootstrap # make # make install # cmake -version MySQL:

# groupadd mysql

# useradd -M -g mysql -s /sbin/nologin mysql //创建mysql用户

# tar xvf mysql-5.5.33.tar.gz //解压源码包 # cd mysql-5.5.33 //进入源码包 # cmake \\ //默认源码包编译

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \\ //软件存放位置

-DSYSCONFDIR=/etc \\ //配置文件存放位置-DMYSQL_DATADIR=/dbdate/mysql/data \\ //库的存放位置

-DINSTALL_MANDIR=/usr/share/man \\ -DMYSQL_TCP_PORT=3306 \\ //服务端口

-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \\ //本地套接字文件 -DDEFAULT_CHARSET=utf8 \\

-DEXTRA_CHARSETS=all \\ //支持字符集 -DDEFAULT_COLLATION=utf8_general_ci \\ -DWITH_READLINE=1 \\ -DWITH_SSL=system \\

-DWITH_EMBEDDED_SERVER=1 \\

-DENABLED_LOCAL_INFILE=1 \\ //允许导入文件

-DWITH_INNOBASE_STORAGE_ENGINE=1 //ENGINE都是引擎

-DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 # make //编译,将源码编译成二进制

# make install //将二进制文件复制到指定位置 暂时不初始化===MySQL初始化 1. 初始化

# cd /usr/local/mysql //进入库

# chown -R mysql:mysql . //更改库属主属组为mysql #

./scripts/mysql_install_db

--user=mysql

--basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data //安装默认的mysql系统库

2. 生成MySQL主配置文件

# cp support-files/http://www..com/doc/4f7352792.html,f /etc/http://www..com/doc/4f7352792.html,f mysql5.6

3. 生成MySQL Sys V脚本

# cp support-files/mysql.server /etc/rc.d/init.d/mysqld //复制mysql启动脚本

# chmod 755 /etc/rc.d/init.d/mysqld

# chkconfig --add mysqld //添加mysql开机启动服务 # chkconfig mysqld on //设置mysql服务开机启动 # service mysqld start //启动服务 4. 配置MySQL环境变量

# echo \"export PATH=$PATH:/usr/local/mysql/bin\" >> /etc/profile

# source /etc/profile 5. 登录MySQL:

# mysqladmin -uroot password 'mysql123' # mysql ERROR

1045

(28000):

Access

denied

for

user

'root'@'localhost' (using password: NO)

# mysql -uroot -pmysql123 mysql> show databases; +--------------------+ | Database |

+--------------------+ | information_schema | | mysql |

| performance_schema | | test |

+--------------------+ 4 rows in set (0.00 sec)

========================================================

# Preconfiguration setup shell> groupadd mysql

shell> useradd -r -g mysql mysql

# Beginning of source-build specific instructions

shell> tar zxvf mysql-VERSION.tar.gz shell> cd mysql-VERSION shell> cmake . shell> make shell> make install

# End of source-build specific instructions # Postinstallation setup shell> cd /usr/local/mysql shell> chown -R mysql . shell> chgrp -R mysql .

shell> scripts/mysql_install_db --user=mysql shell> chown -R root . shell> chown -R mysql data # Next command is optional shell>

cp

support-files/http://www..com/doc/4f7352792.html,f /etc/http://www..com/doc/4f7352792.html,f

shell> bin/mysqld_safe --user=mysql & # Next command is optional

shell> cp support-files/mysql.server /etc/init.d/mysql.server # -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \\ #安装路径 # -DMYSQL_DATADIR=/usr/local/mysql/data \\ #数据文件存放位置

#

-DSYSCONFDIR=/etc

\\

#http://www..com/doc/4f7352792.html,f路径

# -DWITH_MYISAM_STORAGE_ENGINE=1 \\ #支持MyIASM引擎

# -DWITH_INNOBASE_STORAGE_ENGINE=1 \\ #支持InnoDB引擎

# -DWITH_MEMORY_STORAGE_ENGINE=1 \\ #支持Memory

引擎# -DWITH_READLINE=1 \\ #快捷键功能(我没用过) # -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock \\ #连接数据库socket路径# -DMYSQL_TCP_PORT=3306 \\ #端口

# -DENABLED_LOCAL_INFILE=1 \\ #允许从本地导入数据 # -DWITH_PARTITION_STORAGE_ENGINE=1 \\ #安装支持数据库分区# -DEXTRA_CHARSETS=all \\ #安装所有的字符集

# -DDEFAULT_CHARSET=utf8 \\ #默认字符 # -DDEFAULT_COLLATION=utf8_general_ci [syrtsys@netpay1 [mysqld]

# Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0

lower_case_table_names=1 [mysqld_safe]

log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid 看你的mysql当前默认的存储引擎:

mysql> show variables like '%storage_engine%'; create database cipys character set utf8;

grant all privileges on cipys.* to cipys@'%' identified by 'cip@12345';

磁盘阵列挂载至数据库存放文件夹下即可

-DMYSQL_DATADIR=/dbdate/mysql/data \\ //库的存放位置

~]$

cat

/etc/http://www..com/doc/4f7352792.html,f

因篇幅问题不能全部显示,请点此查看更多更全内容