Home > Database > Mysql Tutorial > MYSQL配置关键_MySQL

MYSQL配置关键_MySQL

WBOY
Release: 2016-06-01 13:10:11
Original
951 people have browsed it

在启动管理init.d里关于mysql的命令有

sudo /etc/init.d/mysql start|stop|restart|reload|force-reload|status

sudo apt-get install mysql-server 


GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY "123456"; 


CREATE DATABASE xoops;


其一:


mysql>GRANT ALL PRIVILEGES ON xoops.* TO xoops_root@"%" IDENTIFIED BY "654321";


允许xoops_root用户可以从任意机器上登入MySQL。


其二:


$sudo gedit /etc/mysql/my.cnf


老的版本中


>skip-networking => # skip-networking


新的版本中


>bind-address=127.0.0.1 => bind-address= 你机器的IP


这样就可以允许其他机器访问MySQL了。 


还有最后一步(无法远程时使用这条指令。)

mysql>FLUSH PRIVILEGES

配置同步关键:

1.主服务器上配置my.cnf 开启日志功能,配置server_id,

2.重启mysql服务 etc/init.d/mysql restart

3.主服务器上新增具有replication权限的账户 

grant replication slave on to 'www'@'%' identified by '123.asd'


3.从服务器上配置my.cnf,配置server_id

4.重启从服务器mysql服务

5.配置同步。

change master to master_host=‘192.168.1.118’, 主服务器IP

master_user='www', 主服务器开启的复制权限账户

master_password='123.asd',

master_log_file='mysql-bin.000001',  在主服务器上查询 show master status/G 出来的日志文件名

master_log_pos='309';                 位置文件名


6.重启从服务器mysql服务即可



主主同步只需要在主从服务器上做上述相同配置即可。


修改my.cnf文件前记得关闭MYSQL服务


连接数据库问题,主要看LOG


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template