[转帖]MYSQL:1003错误信息3-2-7_MySQL, Oracle及数据库讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MySQL, Oracle及数据库讨论区 »
总帖数
2
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 2056 | 回复: 1   主题: [转帖]MYSQL:1003错误信息3-2-7        下一篇 
czxingcici
注册用户
等级:新兵
经验:61
发帖:5
精华:0
注册:2012-5-15
状态:离线
发送短消息息给czxingcici 加好友    发送短消息息给czxingcici 发消息
发表于: IP:您无权察看 2018-5-9 11:16:58 | [全部帖] [楼主帖] 楼主

一、软件准备

MySql
Apache
Php
Postfix
courier-authlib
courier-imap
cyrus-sasl
postfixadmin
squirrelmail
---------------------


MySQL           作为后台数据库,实现对用户信息的存储
Apache,PHP      提供web服务
Postfix         作为邮件服务器,提供SMTP服务
Cyrus-sasl      实现SMTP认证
Courier-imap    提供IMAP,POP3服务
Courier-authlib 是支持Courier-imap的关键模块,由于Courier-imap从4版开始把Courier-authlib独立出来了,安装Courier-imap前需要先安装Courier-authlib
PostfixAdmin    实现管理员以web方式对用户和域的管理
Squirrelmain    为用户提供以Web方式登录邮箱

二、安装准备

安装postfix前先停止和删除sendmail服务器:

# /etc/init.d/sendmail stop
# update-rc.d -f sendmail remove
# apt-get install purge sendmail


添加用户和用户组:

 # groupadd postfix -g 1002
# useradd postfix -u 1002 -g 1002
# groupadd vmail -g 1003
# useradd vmail -u 1003 -g 1003


新建邮件的存放目录:

 # mkdir /home/vmail
# chown vmail:vmail /home/vmail/
# chmod -R 755 /home/vmail/


三、MySql、Apache、Php的安装
MySql安装:http://blog.sina.com.cn/s/blog_6b7d19300100nyht.html

Apache,php安装:http://blog.sina.com.cn/s/blog_6b7d19300100nzcq.html

四、courier-authlib安装
下载 :

 http://www.courier-mta.org/download.php#authlib
courier-authlib-0.63.0.tar.bz2


安装gdbm支持:

# apt-get install libgdbm-dev


解压缩

 # tar jxvf courier-authlib-0.63.0.tar.bz2
# cd courier-authlib-0.63.0/


编译安装

 # ./configure --prefix=/usr/local/courier-authlib-0.63 --without-stdheaderdir --without-authpam --without-authldap --without-authpwd --without-authuserdb --without-authpgsql --without-authshadow -
-without-authvchkpw --without-authcustom  --with-mysql-libs=/usr/local/mysql5/lib/mysql --with-mysql-includes=/usr/local/mysql5/include/mysql --with-authmysqlrc=/usr/local/courier-authlib-
0.63/etc/authmysqlrc --with-authdaemonrc=/usr/local/courier-authlib-0.63/etc/authdaemonrc --with-mailuser=vmail --with-mailgroup=vmail
# make
# make install


一定记得在./configure时增加--without-stdheaderdir,这样以后在编译Courier-IMAP和maildrop的时候,不用特别指定courier- authlib的库文件位置

# cd /usr/local/courier-authlib-0.63/etc/
# cp authdaemonrc.dist authdaemonrc
# vim authdaemonrc
authmodulelist="authmysql"
authmodulelistorig="authmysql"
daemons=10
DEBUG_LOGIN=2   //打开日志记录类型,方便调试
# cp authmysqlrc.dist authmysqlrc
# vim authmysqlrc


修改如下:

 MYSQL_SERVER            localhost
MYSQL_USERNAME          postfix
MYSQL_PASSWORD          postfix
MYSQL_SOCKET            /tmp/mysql.sock
MYSQL_PORT              3306
MYSQL_OPT               0
MYSQL_DATABASE          postfix
MYSQL_USER_TABLE        mailbox
MYSQL_CRYPT_PWFIELD     password
MYSQL_UID_FIELD         1003
MYSQL_GID_FIELD         1003
MYSQL_LOGIN_FIELD       username
MYSQL_HOME_FIELD        '/home/vmail'
MYSQL_NAME_FIELD        name
MYSQL_MAILDIR_FIELD     maildir


添加的时候注意,参数和值之间用TAB健,不能用空格

启动courier-authlib:

 # /usr/local/courier-authlib-0.63/sbin/authdaemond start


设置为开机启动

 # cp /usr/local/courier-authlib-0.63/sbin/authdaemond /etc/init.d/
# update-rc.d authdaemond defaults


安装过程出现的错误:
明明指定了 --with-authmysqlrc=/usr/local/courier-authlib-0.63/etc/authmysqlrc 但是courier-authlib-0.63/etc/下面却没有 authmysqlrc.dist 文件!
解决:
重新编译了下mysql加入InnoDB就好了,不知道是不是因为没有InnoDB引擎的关系,还是之前mysql配置有问题...

五、courier-imap 安装

下载:

 http://www.courier-mta.org/download.php#authlib
courier-imap-4.8.1.tar.bz


安装

 # tar jxvf courier-imap-4.8.1.tar.bz2
# cd courier-imap-4.8.1/
# ./configure --prefix=/usr/local/courier-imap-4.8.1 --disable-root-check CPPFLAGS='-I/usr/local/courier-authlib-0.63/include/' COURIERAUTHCONFIG='/usr/local/courier-authlib-
0.63/bin/courierauthconfig'
# make
# make install


修改配置:

 # cd /usr/local/courier-imap-4.8.1/etc
# cp pop3d.dist pop3d
# cp pop3d-ssl.dist pop3d-ssl
# cp imapd.dist imapd
# cp imapd-ssl.dist imapd-ssl


修改pop3d文件

 # vim pop3d
POP3DSTART=YES


修改imapd文件

 # vim imapd
IMAPDSTART=YES


启动服务:

 # /usr/local/courier-imap-4.8.1/libexec/pop3d.rc start
# /usr/local/courier-imap-4.8.1/libexec/imapd.rc start


测试pop3服务:

 # telnet localhost 110
Connected to localhost.     //表示连接成功
quit //退出


测试imapd服务:

 # telnet localhost 143
aa logout       //输入aa logout 表示退出连接


将imap pop3加入到启动项

 # cp /usr/local/courier-imap-4.8.1/libexec/pop3d.rc /etc/init.d/pop3d
# cp /usr/local/courier-imap-4.8.1/libexec/imapd.rc /etc/init.d/imapd
# update-rc.d pop3d defaults
# update-rc.d imapd defaults


六、Cyrus-sasl 安装
下载;

 # wget http://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-sasl-2.1.23.tar.gz
# tar -xzvf cyrus-sasl-2.1.23.tar.gz
# cd cyrus-sasl-2.1.23/


安装

 # ./configure --prefix=/usr/local/cyrus-sasl-2.1.23  --disable-digest --disable-sample --disable-saslauthd --disable-pwcheck --disable-cram --disable-krb4 --disable-gssapi --disable-anon --disable -ntlm --disable-otp --disable-srp --disable-srp-setpass  --enable-sql --enable-plain  --enable-login --with-mysql=/usr/local/mysql5 --with-authdaemond=/usr/local/courier-authlib-
0.63/var/spool/authdaemon/socket
# make
# make install


配置:
关闭原有的sasl:

 # rm -rf /usr/lib/sasl2
# rm -rf /usr/lib/libsasl2.so
# rm -rf /usr/lib/libsasl2.la
# rm -rf /usr/lib/libsasl2.so.2
# rm -rf /usr/lib/libsasl2.so.2.0.23


更新lib库

 # echo "/usr/local/cyrus-sasl-2.1.23/lib/">>/etc/ld.so.conf
# echo "/usr/local/cyrus-sasl-2.1.23/lib/sasl2">>/etc/ld.so.conf
# ldconfig


建立符号连接

 # ln -s /usr/local/cyrus-sasl-2.1.23/lib/* /usr/lib/
# ln -s /usr/local/cyrus-sasl-2.1.23/lib/* /usr/local/lib/
# ln -s /usr/local/cyrus-sasl-2.1.23/lib/sasl/* /usr/local/include/


配置 Cyrus-SASL
在目录 /usr/local/cyrus-sasl-2.1.23/lib/sasl2 下创建smtpd.conf 文件

 # vim /usr/local/cyrus-sasl-2.1.23/lib/sasl2/smtpd.conf


内容:

 pwcheck_method:authdaemond
log_level:3
mech_list:PLAIN LOGIN
authdaemond_path:/usr/local/courier-authlib-0.63/var/spool/authdaemon/socket


设置权限:

 # chmod -R 755 /usr/local/courier-authlib-0.63/var/spool/authdaemon/


递归创建运行目录

 # mkdir -pv /var/state/saslauthd


调试(启动查看信息):

 # /usr/local/cyrus-sasl-2.1.23/sbin/saslauthd -a shadow pam -d


启动并测试

 # /usr/local/cyrus-sasl-2.1.23/sbin/saslauthd -a shadow pam


测试(输入用户名密码):

 # /usr/local/cyrus-sasl-2.1.23/sbin/testsaslauthd -u root -p 123456
OK "Success."   //表示连接成功
NO "authentication failed"   //表示连接失败


设置为开机启动:

 # vim /etc/rc.local


在exit 0 前面加一行

 /usr/local/cyrus-sasl-2.1.23/sbin/saslauthd -a shadow pam


安装过程出现的错误:
make[2]: *** [digestmd5.lo] 错误 1
解决:
刚开始编译的时候出现这个错误,然后baidu google发现很多人都遇到这个问题但很少有答案,后来才发现用了  --enable-digest就会有这个错误而改成 --disable-digest就可以正常编译通过.

make[3]: *** [auth_getpwent.o] 错误 1
解决:
因为没有安装openssl支持.
安装: apt-get install openssl

七、Postfix安装

下载

 http://www.postfix.com/
# wget http://www.postfix.cn/source/official/postfix-2.7.2.tar.gz
# tar -xzvf postfix-2.7.2.tar.gz
# cd postfix-2.7.2/


安装

 # make -f Makefile.init makefiles 'CCARGS=-DHAS_MYSQL -I/usr/local/mysql5/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/local/cyrus-sasl-2.1.23/include/sasl/' 'AUXLIBS=-
L/usr/local/mysql5/lib/mysql -lmysqlclient -L/usr/local/cyrus-sasl-2.1.23/lib/sasl2/ -lsasl2 -lz -lm'
# make install


安装过程中会有路径的选择,全部采用默认的即可

为别名文件创建链接

 # ln -s /etc/postfix/aliases /etc/aliases
# /usr/bin/newaliases


使用postconf -n 简化main.cf,这样的好处是main.cf比较短小,不容易造成同一个配置出现两次的问题:

 # cd /etc/postfix/
# mv main.cf main.cf.old
# postconf > main.cf


修改配置文件:

 # vim main.cf
myhostname = mail.example.com          // mail.example.com是安装Postfix软件的主机名
mydomain = example.com              // example.com是安装Postfix软件的主机名中的域名部分
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost
alias_maps = hash:/etc/aliases
home_mailbox = Maildir/
mynetworks = 127.0.0.0/8 192.168.1.0/24
virtual_mailbox_base = /home/vmail
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 1003
virtual_uid_maps = static:1003
virtual_gid_maps = static:1003
virtual_transport = virtual
smtpd_recipient_restrictions =permit_mynetworks,permit_sasl_authenticated,reject_non_fqdn_hostname,reject_non_fqdn_sender, reject_non_fqdn_recipient,reject_unauth_destination,
reject_unauth_pipelining,  reject_invalid_hostname
smtpd_client_restrictions = permit_mynetworks,permit_sasl_authenticated
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
smtpd_banner = $myhostname ESMTP


在/etc/postfix目录下创建 mysql_virtual_alias_maps.cf,mysql_virtual_domains_maps.cf,mysql_virtual_mailbox_maps.cf 三个文件

 # vim mysql_virtual_alias_maps.cf
user=postfix
password=postfix
hosts=localhost
dbname=postfix
table=alias
select_field=goto
where_field=address
# vim mysql_virtual_domains_maps.cf
user=postfix
password=postfix
hosts=localhost
dbname=postfix
table=domain
select_field=description
where_field=domain
# vim mysql_virtual_mailbox_maps.cf
user=postfix
password=postfix
hosts=localhost
dbname=postfix
table=mailbox
select_field=maildir
where_field=username


启动postfix

 # /usr/sbin/postfix start


加入开机启动

 # cp /usr/sbin/postfix /etc/init.d/postfix
# update-rc.d postfix defaults


测试postfix:

#telnet localhost 25


ehlo localhost  #测试发信是否需要认证

 quit    #退出


安装过程出现的错误:
1.No <db.h> include file found.

 Install the appropriate db*-devel package first.
See the RELEASE_NOTES file for more information.


make: *** [Makefiles] 错误 1
make: *** [makefiles] 错误 2
解决:
安装支持:

 # apt-get install libdb4.8-dev


2.gcc: AUXLIBS=-L/usr/local/mysql5/lib/mysql: 没有那个文件或目录
解决:
只要在AUXLIBS前面加两个' '就好了 --

3.dict_mysql.c: In function ‘plmysql_dealloc’:

 dict_mysql.c:772: error: ‘HOST’ has no member named ‘db’
dict_mysql.c:773: error: ‘HOST’ has no member named ‘db’
dict_mysql.c:774: error: ‘HOST’ has no member named ‘hostname’
dict_mysql.c:775: error: ‘HOST’ has no member named ‘name’
dict_mysql.c:776: error: ‘HOST’ has no member named ‘name’


make: *** [dict_mysql.o] 错误 1
make: *** [update] 错误 1
解决:
因为刚开始的时候看一些文档里面路径用的是/usr/local/mysql5/include,/usr/local/mysql5/lib 所以找不到mysql.h文件
后来改成/usr/local/mysql5/include/mysql,/usr/local/mysql5/lib/mysql 错误就解决了

4:postfix-install: Error: "" should be "no" or an absolute path name.


解决:

 # echo /usr/local/mysql5/lib/mysql >> /etc/ld.so.conf
# ldconfig
5:postfix-install: Error: "postdrop" needs an entry in the group file


解决:
还需要一个'postdrop'的用户组 

 # groupadd postdrop
6.
postfix/smtpd[2082]: warning: xsasl_cyrus_server_get_mechanism_list: no applicable SASL mechanisms
postfix/smtpd[2082]: fatal: no SASL authentication mechanisms
postfix/master[1414]: warning: process /usr/libexec/postfix/smtpd pid 2082 exit status 1
postfix/master[1414]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling


解决:
应该是/usr/local/cyrus-sasl-2.1.23/lib/sasl2/smtpd.conf出了问题,仔细检查内容是否为:

 pwcheck_method:authdaemond
log_level:3
mech_list:PLAIN LOGIN
authdaemond_path:/usr/local/courier-authlib-0.63/var/spool/authdaemon/socket


再或者看下 /usr/lib/sasl2/smtpd.conf,/usr/local/lib/sasl2/smtpd.conf 两个文件映射是否存在

7.postfix/smtpd[2590]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
解决:
/etc/postfix/main.cf 文件的 alias_maps = hash:/etc/aliases 是否正确

八、postfixadmin 安装
下载

 http://sourceforge.net/projects/postfixadmin/files/postfixadmin/postfixadmin-2.3.2/postfixadmin-2.3.2.tar.gz/download


移动到web目录下

 # cp postfixadmin-2.3.2.tar.gz /home/www/


解压

 # tar -xzvf postfixadmin-2.3.2.tar.gz
# mv postfixadmin-2.3.2 postfixadmin


浏览器中输入 http://localhost/postfixadmin/
点击 http://localhost//postfixadmin/INSTALL.TXT
获得安装的帮助信息

创建数据库postfix 及增加一个用户 postfix 密码 postfix:

 # mysql -uroot -p123456
> create database postfix;
> grant all on *.* to 'postfix'@'localhost' identified by 'postfix'


编辑配置文件:

 # vim /home/www/postfixadmin/config.inc.php


修改如下

 $CONF['configured'] = true;     //改为true
$CONF['default_language'] = 'cn';   //中文包
$CONF['database_user'] = 'postfix'; //用户名
$CONF['database_password'] = 'postfix'; //密码
$CONF['database_name'] = 'postfix';     //数据库


安装:

 http://localhost/postfixadmin/setup.php
Change setup password:


输入安装密码 如: aaabbb123

信息提示修改 config.inc.php
加入页面上的显示的setup_password:

# vim /home/www/postfixadmin/config.inc.php
$CONF['setup_password'] = 'f4303d2ef2f6c6c7e375b008e1dd6020:9bfade11787afd1746a27390000107eda25efa84';


再创建一个管理员帐号:

 alan@example.com
123456a


到后台去登录:

 http://localhost/postfixadmin/login.php


先发一封邮件试试

126.com能够正常收到~~哈哈~

新建一个邮箱:

 abc@example.com
abc


向它发一封件:

到/home/vmail下,可以看到一个abc@example.com的帐户目录

九、quirrelmail安装
下载

 http://squirrelmail.org/download.php
# cp squirrelmail-1.4.21.zip.zip /home/www/
# cd /home/www/
# unzip squirrelmail-1.4.21.zip.zip
# mv squirrelmail-1.4.21 squirrelmail


进行配置

 # cd squirrelmail
# ./configure


出现画面:

SquirrelMail Configuration : Read: config_default.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages
D.  Set pre-defined settings for specific IMAP servers
C   Turn color on
S   Save data
Q   Quit
Command >>


输入10 语言包设置

 Language preferences
1.  Default Language       : en_US    -->改成 zh_CN
2.  Default Charset        : iso-8859-1  -->改成 zh_CN.UTF-8
3.  Enable lossy encoding  : false
R   Return to Main Menu
C   Turn color on
S   Save data
Q   Quit


修改默认语言包:

 Command >> 1
SquirrelMail attempts to set the language in many ways.  If it
can not figure it out in another way, it will default to this
language.  Please use the code for the desired language.
[en_US]: zh_CN


输入s 保存设置 输入r 返回上级目录

输入2 服务器设置

 Server Settings
General
-------
1.  Domain                 : example.com    -->改成自己的域名
2.  Invert Time            : false
3.  Sendmail or SMTP       : SMTP


A.  Update IMAP Settings   : localhost:143 (other)  ->改成 (courier)

 B.  Update SMTP Settings   : localhost:25
R   Return to Main Menu
C   Turn color on
S   Save data
Q   Quit
Command >>


返回
输入4 进入全局设置

General Options
1.  Data Directory               : /var/local/squirrelmail/data/        -->可以设定自己的目录 如果使用默认的则创建这个目录 mkdir -pv /var/local/squirrelmail/data/
2.  Attachment Directory         : /var/local/squirrelmail/attach/      -->同上 mkdir -pv /var/local/squirrelmail/attach/
3.  Directory Hash Level         : 0
4.  Default Left Size            : 150
5.  Usernames in Lowercase       : false
6.  Allow use of priority        : true
7.  Hide SM attributions         : false
8.  Allow use of receipts        : true
9.  Allow editing of identity    : true
Allow editing of name        : true
Remove username from header  : false
10. Allow server thread sort     : false
11. Allow server-side sorting    : false
12. Allow server charset search  : true
13. Enable UID support           : true
14. PHP session name             : SQMSESSID
15. Location base                :
16. Only secure cookies if poss. : true
17. Disable secure forms         : false
18. Page referal requirement     :


修改完以后保存退出,这样在 config目录下生成了一个config.php的配置文件,检察配置是否正确

 # vim config/config.php


创建并修改/var/local/squirrelmail/目录权限

 # mkdir -pv /var/local/squirrelmail/data/
# mkdir -pv /var/local/squirrelmail/attach/
# chmod -R 777 /var/local/squirrelmail/


登录邮箱:

 http://localhost/squirrelmail/src/login.php


用刚刚创建的邮箱登录:

 abc@example.com
abc


可以看到刚刚发出来的邮件:

不过界面还是英文版的.....

网上查了一下要下载all_locales-1.4.18-20090526.tar.gz才可以

-----------------------
改下自己的hosts测试

 vim /etc/hosts


把指定的域名向到本机:

 127.0.0.1       example.com




赞(0)    操作        顶端 
联动大白
注册用户
等级:列兵
经验:91
发帖:0
精华:0
注册:2015-5-27
状态:离线
发送短消息息给联动大白 加好友    发送短消息息给联动大白 发消息
发表于: IP:您无权察看 2019-8-22 0:30:00 | [全部帖] [楼主帖] 2  楼

为了方便大家阅读,我对文章中错误号来解释一下吧!

Error Id: MYSQL:1003

Title: ER_YES

Description:

YES


也许你已明白,但对一个人有用也是我存在的理由!^_^ By:持之以恒的大白

-- 来自: 北京联动北方科技有限公司



赞(0)    操作        顶端 
总帖数
2
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论