Announcement

Collapse
No announcement yet.

Mysql data mount problem

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Mysql data mount problem

    Hello all,

    I'm looking to use a partion for my mysql data. I have made a dir /var/www/mysql_data and set this in my.cnf. This works fine. The problem is when I mount my drive /dev/sbd1 to /var/www/mysql_data mysql refuses to start. I've checked the permissions on the new folder and its mysql:mysql.

    Any ideas?

    Thanks

    #2
    Re: Mysql data mount problem

    Are you mounting the drive persistently (like in fstab)? My un-educated guess is that MySQL is auto-starting at boot but it's missing the handshake with the partition. Are you REALLY sure you want to do this? My overall recommendation is to re-size your "/" partition for a large MySQL presence and leave well enough alone.

    IndyTim

    Comment


      #3
      Re: Mysql data mount problem

      Have you looked at the ownership of the directory after you mount the partition?

      Comment


        #4
        Re: Mysql data mount problem

        The ownership of the directory after I have mounted it is mysql:mysql.

        I mounted the dir using mount. Is this a permanent mount?

        Thanks

        Comment


          #5
          Re: Mysql data mount problem

          You'll need to mount it in your fstab for permanence. I'm still not 100% on the sequence of events at bootup. Ie. If MySQL server kicks off before you initiate the mounting in fstab, you're probably in for some difficult times. As I mentioned in my original response, make your life easier and just size "/" to accomodate the larger MySQL.

          Just curious, how large are your databases anyway?

          IndyTim

          Comment


            #6
            Re: Mysql data mount problem

            mysql must be logging to something in /var/log. It may use its own directory of log files or it may show up in /var/log/syslog or /var/log/daemon.log, but at least one of these should contain some message about why mysql will not start.

            Comment


              #7
              Re: Mysql data mount problem

              First the filesystem will mount first but make sure it is in your fstab. It must mount before mysql starts. Also I have had problems with intrepid and apparmor If you move the default location of the database you need to modify the config for apparmor in /etc/apparmor I believe it is spelled correctly but you will want to verify. This is a security feature

              Comment


                #8
                Re: Mysql data mount problem

                I've now added the mount to fstab. Mysql still didn't start but checking syslog has gave some insights.

                It's saying

                InnoDB: The errors means mysqld doesn't have access rights to the directory.

                and

                Can't create test file /var/www/mysql_data/eacmysql01.lower-test

                Can anyone tell me how to give access rights?

                Comment


                  #9
                  Re: Mysql data mount problem

                  in /etc/apparmor.d directory you should have a file named usr.sbin.mysqld

                  edit this file with root privilages and add a line for your new directory similar to the following

                  I have a directory name /data/mysql where I house my database's and logs I needed to add five lines like this:

                  /data/mysql/** rwk,
                  /data/mysql/ r,
                  /data/mysql/** rwk,
                  /data/mysqllogs/ r,
                  /data/mysqllogs/* rw,

                  These lines with your directories in place of mine go at the end inside of the curly brace after added
                  then reboot your server

                  your database should not start!

                  Comment


                    #10
                    Re: Mysql data mount problem

                    Hi,

                    I added the lines

                    /var/www/mysql_data/** rwk,
                    /var/www/mysql_data/ r,
                    /var/www/mysql_data/** rwk,

                    ,rebuilt apparmour and restarted the server but its still not starting.

                    Comment


                      #11
                      Re: Mysql data mount problem

                      What messages are you getting in /var/log/syslog when trying to start the database

                      also check dmesg

                      Comment


                        #12
                        Re: Mysql data mount problem

                        Checking /var/log/syslog im getting different errors now.

                        Mar 11 13:37:27 davidmysql01 mysqld_safe[6390]: started
                        Mar 11 13:37:27 davidmysql01 mysqld[6393]: InnoDB: Log scan progressed past the checkpoint lsn 0 36808
                        Mar 11 13:37:27 davidmysql01 mysqld[6393]: 090311 13:37:27 InnoDB: Database was not shut down normally!
                        Mar 11 13:37:27 davidmysql01 mysqld[6393]: InnoDB: Starting crash recovery.
                        Mar 11 13:37:27 davidmysql01 mysqld[6393]: InnoDB: Reading tablespace information from the .ibd files...
                        Mar 11 13:37:27 davidmysql01 mysqld[6393]: InnoDB: Restoring possible half-written data pages from the doublewrite
                        Mar 11 13:37:27 davidmysql01 mysqld[6393]: InnoDB: buffer...
                        Mar 11 13:37:27 davidmysql01 mysqld[6393]: InnoDB: Doing recovery: scanned up to log sequence number 0 43655
                        Mar 11 13:37:27 davidmysql01 mysqld[6393]: 090311 13:37:27 InnoDB: Starting an apply batch of log records to the database...
                        Mar 11 13:37:27 davidmysql01 mysqld[6393]: InnoDB: Progress in percents: 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
                        Mar 11 13:37:27 davidmysql01 mysqld[6393]: InnoDB: Apply batch completed
                        Mar 11 13:37:27 davidmysql01 mysqld[6393]: 090311 13:37:27 InnoDB: Started; log sequence number 0 43655
                        Mar 11 13:37:27 davidmysql01 mysqld[6393]: 090311 13:37:27 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
                        Mar 11 13:37:27 davidmysql01 mysqld_safe[6405]: ended
                        Mar 11 13:37:42 davidmysql01 /etc/init.d/mysql[6555]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
                        Mar 11 13:37:42 davidmysql01 /etc/init.d/mysql[6555]: ^G/usr/bin/mysqladmin: connect to server at 'localhost' failed
                        Mar 11 13:37:42 davidmysql01 /etc/init.d/mysql[6555]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
                        Mar 11 13:37:42 davidmysql01 /etc/init.d/mysql[6555]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
                        Mar 11 13:37:42 davidmysql01 /etc/init.d/mysql[6555]:

                        Comment


                          #13
                          Re: Mysql data mount problem

                          Hello thanks for all the help.

                          The solution to the last problem is solved on this page for reference.

                          http://www.techiegyan.com/?p=31

                          Thanks

                          Comment

                          Working...
                          X