Description:
operating system: CentOS 5.10 32-bit
mariadb version: mariadb-5.5.33a
mariadb Database Storage directory:/data/mysql
prepare the article:
First, configure IP, DNS, gateway, to ensure that the use of remote connection tools to connect the server, the server Yum command can be used normally
Second, configure the firewall, open 3306 ports
Vi/etc/sysconfig/iptables#编辑
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 3306-j ACCEPT#允许3306端口通过防火墙
Special Note: Many netizens add these two rules to the last line of the firewall configuration, which causes the firewall to start failing, the correct one should be added to the default 22 port under this rule
after you have added the firewall rules as follows:
**********************************************************************************
# Firewall configuration written by System-config-securitylevel
# Manual Customization of this file is not recommended.
*filter
: INPUT ACCEPT [0:0]
: FORWARD ACCEPT [0:0]
: OUTPUT ACCEPT [0:0]
: Rh-firewall-1-input-[0:0]
-A input-j Rh-firewall-1-input
-A forward-j Rh-firewall-1-input
-A rh-firewall-1-input-i lo-j ACCEPT
-A rh-firewall-1-input-p ICMP--icmp-type any-j ACCEPT
-A rh-firewall-1-input-p 50-j ACCEPT
-A rh-firewall-1-input-p 51-j ACCEPT
-A rh-firewall-1-input-p UDP--dport 5353-d 224.0.0.251-j ACCEPT
-A rh-firewall-1-input-p udp-m UDP--dport 631-j ACCEPT
-A rh-firewall-1-input-p tcp-m tcp--dport 631-j ACCEPT
-A rh-firewall-1-input-m state--state established,related-j ACCEPT
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 22-j ACCEPT
-A rh-firewall-1-input-m State--state new-m tcp-p TCP--dport 3306-j ACCEPT
-A rh-firewall-1-input-j REJECT--reject-with icmp-host-prohibited
COMMIT
**********************************************************************************
/etc/init.d/iptables restart#最后重启防火墙使配置生效
third, close SELinux
Vi/etc/selinux/config
#SELINUX =enforcing#注释掉
#SELINUXTYPE =targeted#注释掉
Selinux=disabled#增加
: wq!#保存退出
Shutdown-r now#重启系统
Iv. System Agreement
MARIADB installation Package storage location:/usr/local/src
mariadb Compile installation location:/usr/local/mysql
v. Download Packages
1, download mariadb
Http://mirrors.scie.in/mariadb/mariadb-5.5.33a/kvm-tarbake-jaunty-x86/mariadb-5.5.33a.tar.gz
2, Download CMake (mariadb compilation tool)
Http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz
Download the above two software and upload it to the/USR/LOCAL/SRC directory
System Yun-wei Www.111cn.net warm reminder: qihang01 original content copyright, reproduced please indicate the source and the original link
vi. installation of compiler tools and library files (use CentOS Yum command installation, installation of more, easy to compile and install PHP, Nginx, etc.)
Yum install make apr* autoconf automake Curl curl-devel gcc gcc-c++ gtk+-devel zlib-devel OpenSSL openssl-devel L GD kernel keyutils patch perl kernel-headers compat* cpp glibc libgomp libstdc++-devel keyutils-libs-devel Libsepol-dev El libselinux-devel krb5-devel libxpm* freetype freetype-devel freetype* fontconfig fontconfig-devel libjpeg* libpng* ph P-common php-gd gettext gettext-devel ncurses* libtool* libxml2 libxml2-devel patch Policycoreutils Bison
Installation Article
I. Installation of CMake
Cd/usr/local/src
Tar zxvf cmake-2.8.12.1.tar.gz
CD cmake-2.8.12.1
./configure
Make#编译
Make install#安装
Second, install mariadb
Groupadd MySQL#添加MariaDB数据库安装用户组mysql
useradd-g MySQL mysql-s/bin/false#创建用户mysql并加入到mysql组, MySQL users are not allowed to log on directly to the system
Mkdir-p/data/mysql#创建MariaDB数据库存放目录
Chown-r Mysql:mysql/data/mysql#设置MariaDB数据库目录权限
Mkdir-p/usr/local/mysql#创建MariaDB安装目录
Cd/usr/local/src
Tar zxvf mariadb-5.5.33a.tar.gz#解压
CD mariadb-5.5.33a#进入安装目录
CMake. -dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/data/mysql-dsysconfdir=/etc
#配置
Make#编译
Make install#安装
Cd/usr/local/mysql
CP./SUPPORT-FILES/MY-HUGE.CNF/ETC/MY.CNF#拷贝配置文件(Note: If the/etc directory has a my.cnf under the default, directly overwrite it)
Vi/etc/my.cnf#编辑配置文件, increased in the [mysqld] section
DataDir =/data/mysql#添加MariaDB数据库路径
./scripts/mysql_install_db--user=mysql#生成MariaDB系统数据库
CP./support-files/mysql.server/etc/rc.d/init.d/mysqld#把MariaDB加入系统启动
chmod 755/etc/init.d/mysqld#增加执行权限
Chkconfig mysqld on#加入开机启动
Vi/etc/rc.d/init.d/mysqld#编辑
Basedir =/usr/local/mysql#MariaDB程序安装路径
DataDir =/data/mysql#MariaDB数据库存放目录
Service mysqld Start#启动
Vi/etc/profile#把MariaDB服务加入系统环境变量: Add the following line at the end
Export path= $PATH:/usr/local/mysql/bin
The following two lines link the mariadb library file to the default location of the system so that you can compile software such as PHP without specifying the MARIADB library address.
Ln-s/usr/local/mysql/lib/mysql/usr/lib/mysql
Ln-s/usr/local/mysql/include/mysql/usr/include/mysql
Shutdown-r now#需要重启系统, wait for the system to reboot and continue to operate under the terminal command line
Mysql_secure_installation#设置MariaDB数据库root账号密码
Press Y to enter the password 2 times as prompted
or directly modify the password/usr/local/mysql/bin/mysqladmin-u root-p Password "123456"#修改密码
Service mysqld Restart#重启
Mysql-u root-p#输入上面设置的root密码登录到mariadb控制台, as shown in the following illustration:
System Yun-wei Www.111cn.net warm reminder: qihang01 original content copyright, reproduced please indicate the source and the original link
to this end, the MARIADB database installation is complete!
Original from: osyunwei.com