免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5053 | 回复: 8
打印 上一主题 下一主题

mysql datadir 如何设置为远程的网络共享目录上 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-07-31 09:54 |只看该作者 |倒序浏览
本帖最后由 buypro9 于 2011-07-31 09:59 编辑

这是启动后的错误提示
本地计算机无法启动mysql服务 错误1067进程意外终止


-----------------------------------------
事件查看器中显示的信息是

审核成功
审核日志已经清除
  主要用户名:  SYSTEM
  主域:  NT AUTHORITY
  主登录 ID:  (0x0,0x3E7)
  客户端用户名:  austin6
  客户端域:   abc5200
  客户端登录 ID:  (0x0,0x70DC7)

-----------------------------------------



我将mysql  的datadir设置为
datadir="\\192.168.11.1\disk1_pt1\data"
同时也尝试设置为
datadir="x\data"      # 事先使用net use将\\192.168.11.1\disk1_pt1映射为x盘。并访问正常

结果两种设置都无法启动。都是 “错误1067”


以前曾经可以正常启动过。后来忘记怎么设置了。
大家能否帮我看看到底哪里有问题。

直觉是路径和访问权限问题的问题。


还有个问题。比如我以administrator 登入win 但是我想以 austin6账号启动mysql ? 是否可以实现?

论坛徽章:
0
2 [报告]
发表于 2011-07-31 12:00 |只看该作者


以上是该网络共享目录的设置  不知道设置的是否对?

可就是mysql无法认这个目录。谁能知道?

论坛徽章:
0
3 [报告]
发表于 2011-07-31 17:02 |只看该作者
本帖最后由 buypro9 于 2011-07-31 17:04 编辑

还没人能给予回复啊。 这问题问的人有一些。都没人给出确切的可行的详细设置方法。

这是新找到的。据说可行。但是我测试了一下。还是不行。实在郁闷

我是win2003. 可能xp可行。谁能帮了测试一下???
并确认一下是否可行 (什么平台下?) .  

关键步骤是
----datadir=\\\\networksrv\\shared_data\\data

----datadir=\\\\192.168.0.2\\shared_data\\data

不要使用盘符映射的方法。否则出错。


After some work, I've determined that symbolic links DO NOT WORK with network shares, regardless of configuration. However, it is possible to move the entire MySQL datadir to a network share. Below is the general process:

1. Stop the MySQL service.

2. Change the account that the MySQL service runs under to an account that can read and write to the network share.

3. Copy the MySQL 'data' directory to the new location
--e.g., copy C:\Program Files\MySQL\MySQL Server 4.1\data to Z:\MySQL_Data (or other directory)

4. Open the MySQL configuration file (my.ini) and change the 'datadir' entry to the new network share location
--Found in C:\Program Files\MySQL\MySQL Server 4.1\my.ini
--e.g., change 'datadir=C:/Program Files/MySQL/MySQL Server 4.1/data/' to 'datadir=\\\\COMPUTERNAME\\SHARENAME\\data'
--* Note: You cannot use the mapped drive letter (i.e., Z, you must use the UNC network path.
--Example: COMPUTERNAME='networksrv' IPADDRESS='192.168.0.1' SHARENAME='shared_data'
----datadir=\\\\networksrv\\shared_data\\data
----datadir=\\\\192.168.0.2\\shared_data\\data

5. Start the MySQL service

论坛徽章:
0
4 [报告]
发表于 2011-07-31 18:15 |只看该作者
It sounds like you are trying to use this as an auto-launched service
and have it point to mapped drives. Drive mappings are unique to each
user that logs in so, at reboot, the service is started prior to the
drive mapping ever happening. Using UNC's are the only way in this
case.

Below are the my.ini entries that I use, which work just fine:

basedir = C:/MySQL/
datadir = //Data01/test01/dbdata/data/
tmpdir = //Data01/test02/TEMP/


As you can see, (other than the basedir) they are UNC's but with the
slashes reversed and terminated by a slash. This format also works just
fine for innodb paths.

As a final note: I also found problems with the service until I added
and granted full access to all databases (*.*) an "administrator" user
with the same password as the computers administrator account (or
equivalent win user) and then set the service to log in under that
account (Service properties panel -->Log In tab).

论坛徽章:
0
5 [报告]
发表于 2011-07-31 18:16 |只看该作者
one man show.

论坛徽章:
0
6 [报告]
发表于 2011-08-01 10:18 |只看该作者
呵呵,捧个场,一般都是在linux下的服务器,木有弄过win,学习了

论坛徽章:
0
7 [报告]
发表于 2011-08-01 18:04 |只看该作者
之前我试过用2个实例共享一个存储目录,第2个实例启动不了,linux下,不知道楼主之前启动了的是怎么配置的

论坛徽章:
0
8 [报告]
发表于 2011-08-02 09:17 |只看该作者
本帖最后由 buypro9 于 2011-08-02 09:29 编辑

就我一个人自问自答而已 ????????????




楼上的。要启动的话 只能使用命令行启动。不要使用service 启动mysql 就可以了。
这个只能自己使用。 多用户使用可能会导致数据损坏。

我自己只是一个人使用。任意电脑只要启动本地mysql 和apache
数据放在远程nas上. 达到数据共享的目的


http://bbs.chinaunix.net/thread-3575416-1-1.html

论坛徽章:
0
9 [报告]
发表于 2011-08-02 09:36 |只看该作者
单机版的Mysql主从数据库配置

环 境
mysql-5.0.22 解压版。(Copy 成两份 ,master,slave)
windowsXP
一、Master的设置
1、配制my.ini
   [client]
   port = 3308
   [mysqld]
    port           =3308
    server-id    = 1
    binlog-do-db=test1  ##要同步的数据库名为test1
    log-bin    =mysql-bin

然后在Console 执行: GRANT FILE,SELECT,REPLICATION SLAVE ON *.* TO 'slaver1'@'127.0.0.1' IDENTIFIED BY 'slaver1pwd';
开一个新账号(用户名:slaver1 密码:slaver1pwd)并赋于权限
运行Mysqld.exe,并创建新数据库test1,可在Console下输入:show master status\G查看状态!

   *************************** 1. row*****************
            File: mysql-bin.000305
            Position: 98
            Binlog_Do_DB: test1
            Binlog_Ignore_DB:
  
二、Slaver 的设置

1、配制my.ini
   [client]
   port        = 3309

   [mysqld]
   port        = 3309
   server-id       = 2

   master-host     =   127.0.0.1

   master-user     =   slaver1

   master-password =   slaver1pwd

   master-port     =  3308

   replicate-do-db=test1  ##要同步的数据库

   运行Slaver 的Mysqld.exe,在Console窗口执行 show slave status\G  查看状态,如下:

*************************** 1. row ***************************
             Slave_IO_State: Waiting for master to send event
                Master_Host: 127.0.0.1
                Master_User: slaver1
                Master_Port: 3308
              Connect_Retry: 60
            Master_Log_File: mysql-bin.000305
        Read_Master_Log_Pos: 98
             Relay_Log_File: ccf-3acf6017ef4-relay-bin.000005
              Relay_Log_Pos: 235
      Relay_Master_Log_File: mysql-bin.000305
           Slave_IO_Running: Yes
          Slave_SQL_Running: Yes
            Replicate_Do_DB: test1
        Replicate_Ignore_DB:
         Replicate_Do_Table:
     Replicate_Ignore_Table:
    Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
                 Last_Errno: 0
                 Last_Error:
               Skip_Counter: 0
        Exec_Master_Log_Pos: 98
            Relay_Log_Space: 235
            Until_Condition: None
             Until_Log_File:
              Until_Log_Pos: 0
         Master_SSL_Allowed: No
         Master_SSL_CA_File:
         Master_SSL_CA_Path:
            Master_SSL_Cert:
          Master_SSL_Cipher:
             Master_SSL_Key:
      Seconds_Behind_Master: 0

常见问题

1、SQL I/O Running:  no

      原因:用户名或密码不正确、slaver1的权限不够!


     如果正确的执行:GRANT FILE,SELECT,REPLICATION SLAVE ON *.* TO 'slaver1'@'127.0.0.1' IDENTIFIED BY 'slaver1pwd';  仍然显示SQL I/O Running:NO,可能是Master的用户管理中Slaver用户未选中REPLICATION Client (用Navicat-Manager User ->Slaver1 的右边可选列表 )

2、Slave_SQL_Running: NO

       原因:
       a.程序可能在slave上进行了写操作
       b.slave机器重起后,事务回滚.

        解决方法:

        在Slaver的Console:

         2.1.停掉Slave服务

              mysql>slave stop
         2.2、查看Master的状态:(在Master上执行)
              show master status\G

         2.3、手工同步

mysql> change master to
> master_host='127.0.0.1',
> master_user='slaver1',
> master_password='slaver1pwd',
> master_port=3308,
> master_log_file='mysql-bin.000020',
> master_log_pos=98;
          2.4、重启slave

                mysql> slave start;

附录

       1、查看异常信息文件:一般在data(数据库存文件的存放位置)的文件夹中,后缀名为.err的文件

        2、show processlist\G  可以协助查看用户信息
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP