source: npl/commonservers/mysql5/post.mysqld @ 0105685

gcc484ntopperl-5.22
Last change on this file since 0105685 was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100755
File size: 2.0 KB
Line 
1#!/bin/bash
2#(C)DatuX
3
4#update ld.so.conf paths
5if ! grep /usr/lib/mysql /etc/ld.so.conf; then
6    echo /usr/lib/mysql >> /etc/ld.so.conf || exit 1
7    ldconfig
8fi
9
10svcstop /service/mysql || exit 1
11
12#update config file
13mv /etc/my.cnf.new /etc/my.cnf
14
15#still uses old ib_logfile-size?
16if [ `stat -c %s /home/system/mysql5/ib_logfile0` -lt 60000000 ]; then
17        mv /home/system/mysql5/ib_logfile0 /home/system/mysql5/ib_logfile0.old
18        mv /home/system/mysql5/ib_logfile1 /home/system/mysql5/ib_logfile1.old
19fi
20
21#no mysql 5.x database yet?
22if [ ! -d /home/system/mysql5/mysql ]; then
23        touch /etc/my.passwd
24        #convert mysql4 database?
25        #WARNING: you cant convert from 4.1 to 5.1 directly, you first need to upgrade from 4.1 to 5.0!
26        if [ -d /home/system/mysql ]; then
27                echo "* Converting mysql 4 database to 5.0:"
28                svcstop /service/mysql || exit 1
29
30                #the database can be huge, so make sure nothing bad happens if cp gets aborted:
31                rm -r /home/system/mysql5.tmp &>/dev/null
32                cp -a /home/system/mysql /home/system/mysql5.tmp || exit 1
33                mv /home/system/mysql5.tmp /home/system/mysql5 || exit 1
34
35                #we need to run the database to update it
36                svcstart /service/mysql || exit 1
37                mysql_upgrade --password=`cat /etc/my.passwd` || exit 1
38               
39                #a restart is recommended after upgrading
40                svcstop /service/mysql
41
42        else
43                #create new empty database
44                svcstop /service/mysql || exit 1
45                mkdir -p /home/system/mysql5 || exit 1
46                chown mysql:mysql /home/system/mysql5 || exit 1
47                chmod 750 /home/system/mysql5 || exit 1
48                su mysql -c "mysql_install_db --force" || exit 1
49        fi
50
51        #fix the root password and other stuff if neccesary on the new/converted database:
52        syn3-mysqlfix || exit 1
53#database exists, upgrade it:
54else
55        echo "* Running mysql database upgrade:"
56        #run a 'regular' upgrade on any existing database
57        svcstart /service/mysql || exit 1
58        mysql_upgrade --password=`cat /etc/my.passwd`
59        #a restart is recommended after upgrading
60        svcstop /service/mysql
61
62fi
63
64svcreset /service/mysql || exit 1
Note: See TracBrowser for help on using the repository browser.