วันอาทิตย์ที่ 20 พฤษภาคม พ.ศ. 2561

Install Mysql MariaDB 5.5.32


Install Mysql MariaDB 5.5.32

[root@hosxp ~]#vi /etc/selinux/config
#     disabled - No SELinux policy is loaded.
SELINUX=disabled

[root@hosxp ~]#vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT ## เพิ้มค่านี้เข้าไป
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT ## เพิ้มค่านี้เข้าไป
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

[root@hosxp ~]#vi /etc/security/limits.conf
# เพิ่มข้อมูลนี้เข้าไป
root     soft     nofile     50000
root     hard     nofile     50000
mysql     soft     nofile     50000
mysql     hard     nofile     50000


## ลบ MySQL ในเครื่องออก
[root@hosxp ~]#rpm -qa|grep mysql
[root@hosxp ~]#rpm -e --nodeps mysqlxxxxx
[root@hosxp ~]cp my_MariaDB_xxx.cnf /etc/my.cnf

## Install MySQL MariaDB
[root@hosxp ~]#rpm -ivh MariaDB-5.5.32-centos6-x86_64-client.rpm --nodeps --force
[root@hosxp ~]#rpm -ivh MariaDB-5.5.32-centos6-x86_64-shared.rpm --nodeps --force
[root@hosxp ~]#rpm -ivh MariaDB-5.5.32-centos6-x86_64-server.rpm --nodeps --force

[root@hosxp ~] service mysql start

** หาก Start MySQL ไม่ได้ บอก pid error ให้ทำตามนี้
[root@hosxp ~]rm -rf /var/lib/mysql/*
[root@hosxp ~]ls -al /var/lib/mysql/
[root@hosxp ~]chown -Rv mysql:mysql /var/lib/mysql/*
[root@hosxp ~]sudo -u mysql mysql_install_db
[root@hosxp ~]service mysql start

[root@hosxp ~]/usr/bin/mysqladmin -u root password 'new-password'

##MySQL Create database
[root@hosxp ~]mysql -u root -p  << Enter

MariaDB [(none)]>create database pcu_nonghin default character set tis620;
MariaDB [(none)]>grant all on *.* to sa@'%' identified by 'sa' with grant option;
MariaDB [(none)]>flush privileges;
MariaDB [(none)]>Ctrl-C -- exit!
Aborted
[root@hosxp ~]

log-bin=mysql-bin
server-id=1

 mysql-bin.000001 |   211941

 CHANGE MASTER TO MASTER_HOST='192.168.5.6',
                        MASTER_USER='repl',
                        MASTER_PASSWORD='repl10705',
                        MASTER_LOG_FILE='mysql-bin.000001',
                        MASTER_LOG_POS=211941;

## TIPS ##

cat /etc/redhat-release
rpm -q centos-release
mysql -V

SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'dbName';
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'192.168.5.8' IDENTIFIED BY 'rep10705';

ไม่มีความคิดเห็น:

แสดงความคิดเห็น