日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

linux mysql5.5 一主多从配置

發(fā)布時間:2024/4/13 数据库 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux mysql5.5 一主多从配置 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

安裝前必須刪除原來的安裝

需要檢查 以下文件是否存在 ,如果存儲則要刪除之

/etc/my.cnf

/etc/init.d/mysqld

mysql 依賴的庫

shell> yum search libaio # search for info

shell> yum install libaio # install library

創(chuàng)建mysql 與用戶組,-s /bin/false 表示該用戶不能登錄

shell> groupadd mysql

shell> useradd -r -g mysql -s /bin/false mysql

解壓安裝包至指定目錄

shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz

shell> ln -s full-path-to-mysql-VERSION-OS mysql

shell> cd mysql

mysql 用戶添加權(quán)限

shell> chown -R mysql ./

shell> chgrp -R mysql ./

#創(chuàng)建data目錄并添加權(quán)限

shell> mkdir -p /data/mysql

shell> chown -R mysql:mysql /data/mysql

拷貝配置文件

shell> cp ${basedir}/support-files/my-medium.cnf /etc/my.cnf

#修改配置

[mysqld]

basedir=/home/cbt/svr/mysql

datadir=/data/mysql

character-set-server=utf8

shell> cp support-files/mysql.server /etc/init.d/mysql

#添加環(huán)境變量

shell> vi /etc/profile

PATH=/home/cbt/svr/mysql/bin:$PATH

export PATH

#讓剛才的修改生效

shell> source /etc/profile

啟動及其它配置 #啟動數(shù)據(jù)庫

service mysql start

#開機啟動

chkconfig mysqld on

#初始化mysql的一些設(shè)置

mysql_secure_installation

#回車

Enter current password for root (enter for none):

#y,設(shè)置mysqlroot密碼

Set root password?[Y/n] y

#以下都yes

Remove anonymous users?[Y/n] y

Disallow root login remotely?[Y/n] y

Remove test database and access to it?[Y/n] y

Reload privilege tables now?[Y/n] y

ThanksforusingMySQL!

允許遠程登陸

  • mysql> use mysql;
  • mysql> select host,user,password from user;
  • mysql> update user set password=password('123456') where user='root';
  • mysql> update user set host='%' where user='root' and host='localhost';
  • mysql> flush privileges;
  • ?

    總結(jié)

    以上是生活随笔為你收集整理的linux mysql5.5 一主多从配置的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。