source: npl/commonservers/mysql55/post.mysqld

Last change on this file 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: 1.9 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#useless testfiles from a previous package that shouldnt be there
16rm -rf /usr/mysql-test/ /usr/sql-bench/ &>/dev/null
17
18#no mysql 5.x database yet?
19if [ ! -d /home/system/mysql5/mysql ]; then
20        touch /etc/my.passwd
21        #convert mysql4 database?
22        #WARNING: you cant convert from 4.1 to 5.1 directly, you first need to upgrade from 4.1 to 5.0!
23        if [ -d /home/system/mysql ]; then
24                echo "* Converting mysql 4 database to 5.0:"
25                svcstop /service/mysql || exit 1
26
27                #the database can be huge, so make sure nothing bad happens if cp gets aborted:
28                rm -r /home/system/mysql5.tmp &>/dev/null
29                cp -a /home/system/mysql /home/system/mysql5.tmp || exit 1
30                mv /home/system/mysql5.tmp /home/system/mysql5 || exit 1
31
32                #we need to run the database to update it
33                svcstart /service/mysql || exit 1
34                mysql_upgrade --password=`cat /etc/my.passwd` || exit 1
35               
36                #a restart is recommended after upgrading
37                svcstop /service/mysql
38
39        else
40                #create new empty database
41                svcstop /service/mysql || exit 1
42                mkdir -p /home/system/mysql5 || exit 1
43                chown mysql:mysql /home/system/mysql5 || exit 1
44                chmod 750 /home/system/mysql5 || exit 1
45                su mysql -c "mysql_install_db --force" || exit 1
46        fi
47
48        #fix the root password and other stuff if neccesary on the new/converted database:
49        syn3-mysqlfix || exit 1
50#database exists, upgrade it:
51else
52        echo "* Running mysql database upgrade:"
53        #run a 'regular' upgrade on any existing database
54        svcstart /service/mysql || exit 1
55        mysql_upgrade --password=`cat /etc/my.passwd`
56        #a restart is recommended after upgrading
57        svcstop /service/mysql
58
59fi
60
61svcreset /service/mysql || exit 1
Note: See TracBrowser for help on using the repository browser.