2020年9月15日 星期二

Cent OS 7 Mysql 5.1.73 Install

 setenforce 0

yum info mariadb-libs.x86_64

yum remove mariadb-libs.x86_64


yum install wget gcc ncurses ncurses-devel


cd /tmp

wget http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.73.tar.gz

tar -zxvf mysql-5.1.73.tar.gz 

cd /tmp/mysql-5.1.73/


./configure  '--prefix=/usr/local/mysql' '--without-debug' '--with-charset=utf8' '--with-extra-charsets=all' '--enable-assembler' '--with-pthread' '--enable-thread-safe-client' '--with-mysqld-ldflags=-all-static' '--with-client-ldflags=-all-static' '--with-big-tables' '--with-readline' '--with-ssl' '--with-embedded-server' '--enable-local-infile' '--with-plugins=innobase'


vim configer 

搜尋 $RM "$cfgfile"

改為 $RM -f "$cfgfile"

"error"

/bin/rm: cannot remove 'libtoolT': No such file or directory

config.status: executing default commands



#需yum install gcc-c++


make[1]: *** [my_new.o] Error 127

make[1]: Leaving directory `/tmp/mysql-5.1.73/mysys'

make: *** [all-recursive] Error 1


#故安裝套件完成後

make

make install

#mysql安裝至/usr/local/mysql下



cp support-files/my-medium.cnf /etc/my.cnf

cp -r support-files/mysql.server /etc/init.d/mysqld

/sbin/chkconfig --del mysqld

/sbin/chkconfig --add mysqld

 

配置权限表

chown -R mysql:mysql /usr/local/mysqld

/usr/local/mysql/bin/mysql_install_db --user=mysql

 

 

启动mysql

给/etc/init.d/mysql 执行权限,然后运行

chmod a+wrx /etc/init.d/mysql

/etc/init.d/mysqld start

 

mysql初始化配置:


包括密码设置等

#/usr/local/mysql/bin/mysql_secure_installation


#

mysql root/P@ssw0rd

#


帳號建立與資料庫權限設定

/usr/local/mysql/bin/mysqladmin -u root -h c7m5 password 'P@ssw0rd'


帳號建立

GRANT ALL PRIVILEGES ON *.* TO 'edwin'@'%' IDENTIFIED BY '' WITH GRANT OPTION;

grant all privileges on *.* to 'edwin'@'%' IDENTIFIED BY 'ec5678';



帳號變數設定

export PATH=/usr/local/mysql/bin:$PATH


服務確認

ps -ef|grep mysql


netstat --tunlp


防火牆確認與開啟

sudo firewall-cmd --permanent --add-service=mysql

sudo firewall-cmd --permanent --zone=public --add-port=3306/tcp

firewall-cmd  --reload

firewall-cmd  --list-all




#phpmyadmin


vim /etc/httpd/conf.d/phpmyadmin.conf


<Directory "/usr/share/phpmyadmin">

Order Deny,Allow

Deny from all

Allow from 127.0.0.1

Allow from 192.168.10.0/24 

#新增可以連線資料庫的特定機器的ip位址或是網段



</Directory>



apachectl -k restart


#SMB


沒有留言:

張貼留言