linux change passwor linux change owner - 电脑|办公 - 电脑办公-杀毒安全-网络-V3学习网
微商网
 
 
导航:首页 |电脑|办公|正文

linux change passwor linux change owner

时间:2021-06-15 13:57:41
请问在linux里面怎么新建一个用户? ************Create new user************************* adduser penghan passwd peng
作者:

linux change passwor

请问在linux里面怎么新建一个用户?

************Create new user************************* adduser penghan passwd penghan #Changing password for user penghan New password: //input password Retype new password: //input again # Updated successfully //Over ********************Change default startup file*********** Method one: which tcsh # /bin/tcsh chsh # changing shell for penghan Password: //input your password New shell [/bin/tcsh]: /bin/tcsh # Shell changed. Method two: Find a file "passwd" in /etc Open it. Find your user name,in which line change "/bin/bash" to /bin/tcsh" ****************************************************** ok!You can start your icfb from your root.

linux如何设置一般用户密码必须达到一定强度?还有3月强制更改一次...

密码复杂度在[root@localhost ~]# vim /etc/pam.d/system-auth里找到password requisite pam_cracklib.so在后面可以加 difok=x(要x个不同字符) minlen=x(最小密码长度) ucredit=-x(最少x个大写字母) lcredit=-x(最少x个小写字母) dcredit=-x (最少x个数字)dictpath=/usr/share/cracklib/pw_dict时间在[root@localhost ~]# vim /etc/login.defsPASS_MAX_DAYS 99999 (最大什么时候过期)PASS_MIN_DAYS 0 (最小什么事后过期)PASS_MIN_LEN 5 (密码最小长度)PASS_WARN_AGE 7 (警告天数)我们在使用linux系统设置密码的时候,经常遇到这样的问题,系统提示:您的密码太简单,或者您的密码是字典的一部分。

那么系统是如何实现对用户的密码的复杂度的检查的呢?系统对密码的控制是有两部分(我知道的)组成:1 cracklib2 login.defs声明:login.defs主要是控制密码的有效期。

对密码进行时间管理。

此处不细谈login.defs --shadow password suite configurationpam_cracklib.so 才是控制密码复杂度的关键文件redhat公司专门开发了cracklib这个安装包来判断密码的复杂度可以rpm -ql cracklib查看密码的复杂度的判断是通过pam模块控制来实现的,具体的模块是pam_cracklibpam_cracklib 的参数介绍:debug This option makes the module write information to syslog(3) indicating the behavior of the module (this option does not write password information to the log file). type=XXX The default action is for the module to use the following prompts when requesting passwords: "New UNIX password: " and "Retype UNIX password: ". The default word UNIX can be replaced with this option. retry=N Prompt user at most N times before returning with error. The default is 1 difok=N This argument will change the default of 5 for the number of characters in the new password that must not be present in the old password. In addition, if 1/2 of the characters in the new password are different then the new password will be accepted anyway. difignore=N How many characters should the password have before difok will be ignored. The default is 23. minlen=N The minimum acceptable size for the new password (plus one if credits are not disabled which is the default). In addition to the number of characters in the new password, credit (of +1 in length) is given for each different kind of character (other, upper, lower and digit). The default for this parameter is 9 which is good for a old style UNIX password all of the same type of character but may be too low to exploit the added security of a md5 system. Note that there is a pair of length limits in Cracklib itself, a "way too short" limit of 4 which is hard coded in and a defined limit (6) that will be checked without reference to minlen. If you want to allow passwords as short as 5 characters you should not use this module. dcredit=N (N >= 0) This is the maximum credit for having digits in the new password. If you have less than or N digits, each digit will count +1 towards meeting the current minlen value. The default for dcredit is 1 which is the recommended value for minlen less than 10. (N = 0) This is the maximum credit for having upper case letters in the new password. If you have less than or N upper case letters each letter will count +1 towards meeting the current minlen value. The default for ucredit is 1 which is the recommended value for minlen less than 10. (N > 0) This is the minimum number of upper case letters that must be met for a new password.lcredit=N (N >= 0) This is the maximum credit for having lower case letters in the new password. If you have less than or N lower case letters, each letter will count +1 towards meeting the current minlen value. The default for lcredit is 1 which is the recommended value for minlen less than 10. (N = 0) This is the maximum credit for having other characters in the new password. If you have less than or N other characters, each character will count +1 towards meeting the current minlen value. The default for ocredit is 1 which is the recommended value for minlen less than 10. (N < 0) This is the minimum number of other characters that must be met for a new password.use_authtok This argument is used to force the module to not prompt the user for a new password but use the one provided by the previously stacked password module. dictpath=/path/to/dict Path to the cracklib dictionaries. dictpath=/path/to/dict //注:密码字典,这个是验证用户的密码是否是字典一部分的关键。

Path to the cracklib dictionaries.cracklib密码强度检测过程首先...

如何在 Linux 上设置密码策略

准备工作 安装 PAM 的 cracklib 模块,cracklib 能提供额外的密码检查能力。

Debian、Ubuntu 或 Linux Mint 系统上:$ sudo apt-get install libpam-cracklib CentOS、Fedora、RHEL 系统已经默认安装了 cracklib PAM 模块,所以在这些系统上无需执行上面的操作。

为了强制实施密码策略,我们需要修改 /etc/pam.d 目录下的 PAM 配置文件。

一旦修改,策略会马上生效。

注意:此教程中的密码策略只对非 root 用户有效,对 root 用户无效。

禁止使用旧密码 找到同时有 “password” 和 “pam_unix.so” 字段并且附加有 “remember=5” 的那行,它表示禁止使用最近用过的5个密码(己使用过的密码会被保存在 /etc/security/opasswd 下面)。

Debian、Ubuntu 或 Linux Mint 系统上:$ sudo vi /etc/pam.d/common-password password [success=1 default=ignore] pam_unix.so obscure sha512 remember=5 CentOS、Fedora、RHEL 系统上:$ sudo vi /etc/pam.d/system-auth password sufficient pamunix.so sha512 shadow nullok tryfirstpass useauthtok remember=5 设置最短密码长度 找到同时有 “password” 和 “pam_cracklib.so” 字段并且附加有 “minlen=10” 的那行,它表示最小密码长度为(10 - 类型数量)。

这里的 “类型数量” 表示不同的字符类型数量。

PAM 提供4种类型符号作为密码(大写字母、小写字母、数字和标点符号)。

如果你的密码同时用上了这4种类型的符号,并且你的 minlen 设为10,那么最短的密码长度允许是6个字符。

Debian、Ubuntu 或 Linux Mint 系统上:$ sudo vi /etc/pam.d/common-password password requisite pam_cracklib.so retry=3 minlen=10 difok=3 CentOS、Fedora、RHEL 系统上:$ sudo vi /etc/pam.d/system-auth password requisite pam_cracklib.so retry=3 difok=3 minlen=10 设置密码复杂度 找到同时有 “password” 和 “pam_cracklib.so” 字段并且附加有 “ucredit=-1 lcredit=-2 dcredit=-1 ocredit=-1” 的那行,它表示密码必须至少包含一个大写字母(ucredit),两个小写字母(lcredit),一个数字(dcredit)和一个标点符号(ocredit)。

Debian、Ubuntu 或 Linux Mint 系统上:$ sudo vi /etc/pam.d/common-password password requisite pam_cracklib.so retry=3 minlen=10 difok=3 ucredit=-1 lcredit=-2 dcredit=-1 ocredit=-1 CentOS、Fedora、RHEL 系统上:$ sudo vi /etc/pam.d/system-auth password requisite pam_cracklib.so retry=3 difok=3 minlen=10 ucredit=-1 lcredit=-2 dcredit=-1 ocredit=-1 设置密码过期期限 编辑 /etc/login.defs 文件,可以设置当前密码的有效期限,具体变量如下所示:$ sudo vi /etc/login.defs PASSMAXDAYS 150 PASSMINDAYS 0 PASSWARNAGE 7 这些设置要求用户每6个月改变他们的密码,并且会提前7天提醒用户密码快到期了。

如果你想为每个用户设置不同的密码期限,使用 chage 命令。

下面的命令可以查看某个用户的密码限期:$ sudo chage -l xmodulo Last password change : Dec 30, 2013 Password expires : never Password inactive : never Account expires : never Minimum number of days between password change : 0 Maximum number of days between password change : 99999 Number of days of warning before password expires : 7 默认情况下,用户的密码永不过期。

下面的命令用于修改 xmodulo 用户的密码期限:$ sudo chage -E 6/30/2014 -m 5 -M 90 -I 30 -W 14 xmodulo 上面的命令将密码期限设为2014年6月3日。

另外,修改密码的最短周期为5天,最长周期为90天。

密码过期前14天会发送消息提醒用户,过期后帐号会被锁住30天。

linux 下如何通过root 修改别的账户密码

首先,用root用户登陆Linux系统或者使用su、sudo等命令提升到root权限。

其次,修改帐户密码,只需要使用passwd命令即可,该命令详细介绍如下: passwd 选项 用户名 可使用的选项: -l 锁定口令,即禁用账号。

-u 口令解锁。

-d 使账号无口令。

-f 强迫用户下次登录时修改口令。

如果默认用户名,则修改当前用户的口令。

例如,假设当前用户是sam,则下面的命令修改该用户自己的口令: $ passwd Old password:****** New password:******* Re-enter new password:******* 如果是超级用户,可以用下列形式指定任何用户的口令: # passwd sam New password:******* Re-enter new password:******* 普通用户修改自己的口令时,passwd命令会先询问原口令,验证后再要求用户输入两遍新口令,如果两次输入的口令一致,则将这个口令指定给用户;而超级用户为用户指定口令时,就不需要知道原口令。

为了系统安全起见,用户应该选择比较复杂的口令,例如最好使用8位长的口令,口令中包含有大写、小写字母和数字,并且应该与姓名、生日等不相同。

为用户指定空口令时,执行下列形式的命令: # passwd -d sam 此命令将用户sam的口令删除,这样用户sam下一次登录时,系统就不再询问口令。

passwd命令还可以用-l(lock)选项锁定某一用户,使其不能登录,例如: # passwd -l sam...

Linux:创建账户后强制用户更改密码后才能登录,第二行命令是什么...

ubuntu学习群:65563370 该文章是小弟学习linux归纳出来的一些基础知识,也是做为自己的参考资料,希望各位渴望学习linux的朋友们共同学习。

1、linux分区 --在linux里面所有的设备、任何东西,在linux看来都是文件。

--文件在它看来,有两种形式: 第一种是字符型(键盘输入、打印机); 第二种是二进制型(硬盘、光驱、U盘) --linux中所有硬件 --手动分区 --A、至少有两个分区 / 根分区 SWAP 交换分区(物理内存大小的两倍) --B、个人桌面分区 / /boot 128MB is enough /usr SWAP /tmp(用于光盘刻录) 2、linux目录说明 --/dev/xxyN --xx (分区所在设备类型:hd--IDE硬盘 sd--SCSI硬盘) --y (标明分区所在设备 例如:/dev/hda 第一个IDE硬盘 或 /dev/hdb 第二个IDE硬盘 或 /dev/sdb 第二个SCSI硬盘) --N (数字代表分区:1-4--主分区或扩展分区;逻辑分区从5开始! 例如:/dev/hda3 第一个IDE硬盘上的第三个主分区或扩展分区 /dev/sdb6 第二个SCSI硬盘上的第二个逻辑分区) 3、linux目录结构 / 根目录,最高级别 /bin 系统基本命令存放目录(/usr/bin) /boot linux的内核及引导系统程序文件存放目录(如:vmlinuz、initrd.img) 一般情况下,GRUB或LILO系统引导管理也位于这个目录 /dev 设备文件存储目录,如声卡、光驱... /ect 存放系统设置文件(如用户账号密码、服务器配置文件等) /home 普通用户家目录,默认存放目录 /lib 库文件存放目录 /lost+found 在ext2或ext3文件系统中,当系统以外崩溃或机器意外关机,而产生一些文件碎片放在这里。

当系统启动的过程中,fsck工具会检查这里,并修复已经损坏的文件系统。

有事喜用发生问题,有很多的文件被移到这个目录中,可能会用手工的方式来修复,或者移文件到原来的位置上。

/media 即插即用型存储设备的挂载点自动在这个目录下创建。

如USB盘系统自动挂在后,会在这个目录下产生一个目录; 类似cdrom的目录 /mnt 存放挂载存储设备的挂载目录,如cdrom等目录 /opt 表示可选的意思,有些软件包也会被安装在此,也就是自定义软件包, 比如OpenOffice,或者一些我们自己编译的软件包,也可安装此处。

/proc 操作系统运行时,进程(正在运行的程序)信息及内核信息(比如CPU、硬盘分区、内存信息等)存放在此。

/proc目录是伪装的文件系统proc的挂载目录,proc并不是真正的文件系统 /root linux超级权限用户root的家目录 /sbin 大多是涉及系统管理的命令的存放,只有超级权限用户root才可执行命令存放,普通用户无权限执行此目录下的命令 与 /usr/sbin; /usr/X11R6/sbin; usr/local/sbin 目录相似 (sbin,只有root权限才能执行) /tmp 临时文件目录,有时用户运行程序的时候,会产生临时文件。

/var/tmp目录和此目录相似 /usr 系统存放程序的目录,如命令、帮助文件等。

这个目录下有很多的文件和目录。

大部分Linux发行版提供的软件包都安装在此,涉及服务器的配置文件就安装在/ect中。

/usr/share/fonts 字体目录 /usr/share/man 或 /usr/share/doc 帮助目录 /usr/bin 或 /usr/local/bin 或 /usr/X11R6/bin 普通用户可执行文件目录 /usr/sbin 或 /usr/local/sbin 或 /usr/X11R6/sbin 超级权限用户root可执行命令存放目录 /usr/include 程序头文件存放目录 /var (vary)此目录经常变动 /var/log 用来存放系统日志 /var/www 用来定义Apache服务器站点存放 /var/lib 用来存放一些库文件,如MySQL的,以及MySQL数据库的存放地。

4、基本命令 --查看帮助 *** --help *** --? --查看详细帮助 man *** --登录 login --退出窗口 exit --关机 shutdown --重启 reboot --初始化 init (run level -/etc/inittab),0-6看第六部分的g --进入根目录 cd / --回上层目录 cd .. --相对路径 cd dev --绝对路径 cd /dev --查用户名 whoami --查当前目录 pwd --列出当前目录内容 ls -l(树详细显示目录内容) -m(横列显示目录内容,是屏幕长度显示) -a(列出全部文件,包括隐藏文件) -S(以文档大小排序) --创建目录 mkdir dname --删除目录 rmdir dname rm -r *** -(递归删除该目录下所有内容,询问每个准备删除的文件) rm -rf ***-(强制删除该目录下所有内容,不询问) --创建空白文件 touch *** (ps:从技术的角度来讲,linux的文件后缀名没有任何意义) --复制 cp cp -r **1 **2 (复制1到2中) --移动 mv mv -t **1 **2 (把2移动到1中) --编辑文本 vi [文件名] --查看文本 cat 由第一行开始显示文本内容 tac 从最后一行显示,可以看出 tac 是 cat 的倒着写 more 一页一页的显示文档内容 less 与 more 类似,可以往前翻页 head 只看头几行 -N(数字,可根据行数显示) tail 只看后几行 -N(数字,可根据行数显示) nl 显示的时候,顺序输出行号 od 以二进制位的方式读取档案内容 --查找文本 find [路径][查找类型][搜索文件名] 如查找rc.local find /etc -name *.local --查找命令信息及其位置 whereis 命令 如 whereis ls --查看环境变量 echo $SHELL 如 echo $PATH (分大小写:分隔符是:,windows是echo %path%;) --链接 ln 如 ln joe.txt a (硬链接,如同复制一个新文件,joe.txt删除后,a还存在) a是链接的名称,a和joe.txt同步,然后a的内容和joe.txt一样 joe.txt改变,...

如何在windows下使用linux的shell脚本

需要先用root用户进行授权,1. 首先服务器要安装ftp软件,查看是否已经安装ftp软件下:执行命令: #which vsftpd如果看到有vsftpd的目录说明服务器已经安装了ftp软件2. 查看ftp 服务器状态 执行命令: #service vsftpd status3. 启动ftp服务器 执行命令: #service vsftpd start4. 重启ftp服务器 执行命令: #service vsftpd restart5. 查看服务有没有启动执行命令: #netstat -an | grep 21tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 如果看到以上信息,证明ftp服务已经开启。

6.如果需要开启root用户的ftp权限要修改以下两个文件执行命令: #vi /etc/vsftpd.ftpusers中注释掉root执行命令: #vi /etc/vsftpd.user_list中也注释掉root然后重新启动ftp服务。

7.vsftpd 500 OOPS: cannot change directory登陆报错:C:\>ftp 地址Connected to 地址.220 (vsFTPd 2.0.5)User (地址:(none)): frank331 Please specify the password.Password:500 OOPS: cannot change directory:/home/frankLogin failed.ftp>ls500 OOPS: child diedConnection closed by remote host.解决方法:setsebool ftpd_disable_trans 1service vsftpd restart就OK了!这是SELinux的设置命令,在不熟悉SELnux前,把SELinux关掉也可以的。

8.永久开启,即os重启后自动开启ftp服务方法一:执行命令:cd /etc/xinetd.d ,编辑ftp服务的配置文件gssftp的设置:执行命令:编辑gssftp文件: vi /etc/xinetd.d/gssftp ,将 修改两项内容:(a) server_args = -l –a 去掉-a 改为server_args = -l(b) disable=yes改为disable=no(c) 保存退出。

方法二:(a) system-config-services , 进入图形界面的System services查看是否有 vsftpd项,如果没有转到2.,保存后退出(b) 用redhat第三张盘 安装此服务(开始--删除/增加程序),200K左右(c) #setup此时能看到vsftpd项,此时选中此services项,保存后退出.

Linux下设置vsftpd虚拟账号输入密码出现530错误

Also;vsftpd.pam /.#xferlog_file=/var/log/vsftpd:复制代码代码如下:pam_service_name=vsftpd $ echo "pam_service_name=vsftpd" >ftp这个文件(默认源码安装的不会有这个文件)!#chown_uploads=YES#chown_username=whoever## You may override where the log file goes if you like. The default is shown# below;ftpusers,是这个文件/etc/vsftpd/.d/, to make the ftp daemon more usable; for uploaded files is not# recommended.d/etc/vsftpd.conf# Example config file //etc/vsftpd/root&quot,因此除了匿名用户外本地用户无法登录:[root@atr-3-server1 admin]# cat /etc/vsftpd/ftp path为vsftp解压缩源文件目录 这是因为我们RHEL启用了PAM.dirmessage_enable=YES## Activate logging of uploads/.## READ THIS: This example file is NOT an exhaustive list of vsftpd options, you can arrange for uploaded anonymous files to be owned by# a different user. Note! Using "etc/.log## If you want;downloads方法一:登录出现 vsftpd 530 login incorrect 报错;vsftpd.conf## The default compiled in settings are fairly paranoid. This sample file# loosens things up a bit: cp Path/RedHat/.xferlog_enable=YES## Make sure PORT transfer connections originate from port 20 (ftp-data).connect_from_port_20=YES## If you want;vsftpd/user_list和/&gt.5 manual page to get a full idea of vsftpd"s# capabilities.## Allow anonymous FTP。

但是就是想不出为什么,还以为是用户名和口令错误呢。

后来才google了一下,发现是server端的配置有问题。

检查/etc/? (Beware - allowed by default if you comment this out).anonymous_enable=no## Uncomment this to allow local users to log in.local_enable=YES## Uncomment this to enable any form of FTP write command.write_enable=YES## Default umask for local users is 077. You may wish to change this to 022,# if your users expect that (022 is used by most other ftpd"s)local_umask=022## Uncomment this to allow the anonymous FTP user to upload files;etc/pam;etc/。

方法二:在测试Checkpoint的VPN1 R6x的时候,遇到了这个错误。

这说明client端跟server端的连接性是没问题, you will# obviously need to create a directory writable by the FTP user.#anon_upload_enable=YES## Uncomment this if you want the anonymous FTP user to be able to create# new directories.#anon_mkdir_write_enable=YES## Activate directory messages - messages given to remote users when they# go into a certain directory, you can have your log file in standard ftpd xferlog formatxferlog_std_format=YES## You may change the default value for timing out an idle session.#idle_session_timeout=600## You may change the default value for timing out a data connection.#data_connection_timeout=120## It is recommended that you define on your system a unique user which the# ftp server can use as a totally isolated and unprivileged user.#nopriv_user=ftpsecure## Enable this and the server will recognise asynchronous ABOR requests. Not# recommended for security (the code is non-trivial). Not enabling it,# however, may confuse older FTP clients.#async_abor_enable=YES## By default the server will pretend to allow ASCII mode but in fact ignore# the request. Turn on the below options to have the server actually do ASCII# mangling on files when in ASCII mode.# Beware that turning on ascii_download_enable enables malicious remote parties# to consume your I/O resources, by issuing the command "SIZE /big/file" in# ASCII mode.# These ASCII options are split into upload and download because you may wish# to enable ASCII uploads (to prevent uploaded scripts etc. from breaking),# without the DoS risk of SIZE and ASCII downloads. ASCII mangling should be# on the client anyway..#ascii_upload_enable=YES#ascii_download_enable=YES## You may fully customise the login banner string:#ftpd_banner=Welcome to blah FTP service.## You may specify a file of disallowed anonymous e-mail addresses. Apparently# useful for combatting certain DoS attacks.#deny_email_enable=YES# (default follows)#banned_email_file=/etc/vsftpd.banned_emails## You may specify an explicit list of local users to chroot() to their home# directory. If chroot_local_user is YES, then this list becomes a list of# users to NOT chroot().#chroot_list_enable=YES# (default follows)#chroot_list_file=/etc/vsftpd.chroot_list## You may activate the "-R" option to the builtin ls. This is disabled by# default to avoid remote users being able to cause excessive I/O on large# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume# the presence of the "-R" option, so there is a strong case for enabling it.#ls_recurse_enable=YE...

mysql的主从复制,linux重启后遇到问题。

1、编辑数据库配置文件my.cnf,一般在/etc/目录下。

#vi /etc/my.cnf 在[mysqld]的下面加入下面代码:log-bin=mysql-bin server-id=1 innodb_flush_log_at_trx_commit=1 sync_binlog=1 binlog-do-db=wordpress binlog_ignore_db=mysql server-id=1中的1可以任定义,只要是唯一的就行。

binlog-do-db=wordpress是表示只备份wordpress。

binlog_ignore_db=mysql表示忽略备份mysql。

不加binlog-do-db和binlog_ignore_db,那就表示备份全部数据库。

2、然后重启MySQL:#service mysqld restart3、登录MySQL服务器。

#mysql -uroot -p 在主服务器新建一个用户赋予“REPLICATION SLAVE”的权限。

你不需要再赋予其它的权限。

在下面的命令,把X.X.X.X替换为从服务器的IP。

mysql>CREATE USER "user"@ "X.X.X.X" IDENTIFIED BY "password"; mysql>GRANT REPLICATION SLAVE ON *.* TO "user"@"X.X.X.X" IDENTIFIED BY "password";4、执行以下命令锁定数据库以防止写入数据。

mysql>FLUSH TABLES WITH READ LOCK;5、退出mysql命令行,导出数据库#mysqldump -u root -p123456 --all-databases --lock-tables=false -- > /root/all.sql6、使用scp命令传输数据库文件all.sql到从服务器。

#scp /root/all.sql root@www.example.com:/root7、再次连接数据库进入mysql命令行查看master状态。

mysql>SHOW MASTER STATUS; 请记下显示的信息,配置从服务器会用到。

+——————+———-+————–+——————+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB |+——————+———-+————–+——————+ | mysql-bin.000003 | 1001741 | dbispconfig | mysql |+——————+———-+————–+——————+1 row in set (0.00 sec)8、解锁数据表。

mysql>UNLOCK TABLES; 配置从服务器(slave) 登录从服务器。

1、导入主服务器的数据库。

#mysql -u root -p123456 2、编辑配置文件my.cnf,在[mysqld]下面加入:server-id=22可以自己定义,只要保证唯一的就行。

3、保存文件并重启mysqld。

#service mysqld restart4、登录mysql服务器,执行以下命令。

mysql>CHANGE MASTER TO MASTER_HOST="X.X.X.X",MASTER_USER="user",MASTER_PASSWORD="password",MASTER_PORT=3306,MASTER_LOG_FILE="mysql-bin.000001",MASTER_LOG_POS=98,MASTER_CONNECT_RETRY=10; MASTER_HOST:主服务器的IP。

MASTER_USER:配置主服务器时建立的用户名 MASTER_PASSWORD:用户密码 MASTER_PORT:主服务器mysql端口,如果未曾修改,默认即可。

5、启动slave进程。

mysql>START SLAVE;6、查看mysql的日志,一般在/var/log/目录下的mysqld.log,如果启动成功,你应该会看到类似下面的日志。

[root@localhost ~]# vi /etc/my.cnf091104 8:42:02 [Note] Slave I/O thread: connected to master "root@X.X.X.X:3306?, replication started in log "mysql-bin.000001? at position 98 现在主服务器和从服务器已经配置好了。

另外可能需要设置主服务器的数据库二进制日志的过期时间,可以在配置文件中使用参数expire_logs_days来设定。

大家还关注
    
阅读排行
推荐阅读