Blog

Nov
13
system-configuration-aix

Your first hour with MySQL on AIX

Most modern Linux distros come with MySQL preinstalled, or it can easily be added later using a tool such as YUM. Unfortunately AIX still has no such tool, and you have to maunally download the individual RPMs and pre-reqs.

Here is an example of how to download the packages, install and configure them:

1. Download the PreReqs:

# wget http://www.oss4aix.org/download/RPMS/openssl/openssl-1.0.1g-1.aix5.1.ppc.rpm

# wget http://www.oss4aix.org/download/RPMS/openssl/openssl-devel-1.0.1g-1.aix5.1.ppc.rpm

# wget http://www.oss4aix.org/download/RPMS/zlib/zlib-devel-1.2.8-1.aix5.1.ppc.rpm

# wget wget http://www.oss4aix.org/download/RPMS/zlib/zlib-devel-1.2.8-1.aix5.1.ppc.rpm

# wget http://www.oss4aix.org/download/RPMS/perl-DBI/perl-DBI-1.622-1.aix5.1.ppc.rpm

# wget http://www.oss4aix.org/download/RPMS/perl-DBD-MySQL/perl-DBD-MySQL-4.022-1.aix5.1.ppc.rpm

2. Download the main packages:

# mkdir /fixes/mysql

# cd /fixes/mysql

# wget http://www.oss4aix.org/download/RPMS/mysql/mysql-5.1.73-1.aix5.1.ppc.rpm

# wget http://www.oss4aix.org/download/RPMS/mysql/mysql-bench-5.1.73-1.aix5.1.ppc.rpm

# wget http://www.oss4aix.org/download/RPMS/mysql/mysql-libs-5.1.73-1.aix5.1.ppc.rpm

# wget http://www.oss4aix.org/download/RPMS/mysql/mysql-server-5.1.73-1.aix5.1.ppc.rpm

# wget http://www.oss4aix.org/download/RPMS/mysql/mysql-test-5.1.73-1.aix5.1.ppc.rpm

These packages are optional:

# wget ftp://www.oss4aix.org/RPMS/mysql/mysql-cluster-5.0.96-1.aix5.1.ppc.rpm

# wget ftp://www.oss4aix.org/RPMS/mysql/mysql-embedded-5.1.73-1.aix5.1.ppc.rpm

3. Install the packages:

# rpm -Uvh ./perl-DBD-MySQL-4.022-1.aix5.1.ppc.rpm

# rpm -Uvh ./perl-DBD-MySQL-4.022-1.aix5.1.ppc.rpm –nodeps

# rpm -Uvh ./openssl-1.0.1g-1.aix5.1.ppc.rpm ./openssl-devel-1.0.1g-1.ai

# rpm -Uvh ./my*

You may have play around with the prereqs before the install works.

The MySQL installation should create a dedicated “mysql”

# id mysql

uid=64400(mysql) gid=64400(mysql) groups=1(staff)

4. Re-linking the applications:

The binaries are installed in”/opt/freeware/bin”

Run ./mysql-switch-to-64_bit.sh to relink the 64-bit binaries.

Several “my.cnf” files are supplied:

/opt/freeware/etc/my.cnf

/opt/freeware/share/mysql-test/suite/federated/my.cnf

/opt/freeware/share/mysql-test/suite/ndb/my.cnf

/opt/freeware/share/mysql-test/suite/rpl/my.cnf

/opt/freeware/share/mysql-test/suite/rpl_ndb/my.cnf

If you would like to view one of the man pages

# man 1 -M /opt/freeware/man/man1 mysql_install_db

5. Start the server:

Ensure that the logfile exists “/var/log/mysqld.log”

# /opt/freeware/libexec/mysqld &

6. Test the databases:

$ /opt/freeware/bin/mysqlcheck –databases mysql -p

Enter password:
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.general_…

7. Configure the admin passwords;

# /opt/freeware/bin/mysqladmin -u root password ‘new-password’

# /opt/freeware/bin/mysqladmin -u root -h p520-aix61 password ‘new-password’

8. Check the databases are properly configured:

$ cd /opt/freeware/share/mysql-test ; perl ./mysql-test-run.pl

9. Connect to the database and run some tests:

$ /opt/freeware/bin/mysql -u root mysql

Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.73 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> show tables;

+—————————+
| Tables_in_mysql |
+—————————+
| columns_priv |
| db |
| event |
| func |
| general_log |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| servers |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+—————————+
23 rows in set (0.00 sec)

mysql> select * from db;

+——+———+——+————-+————-+————-+————-+————-+———–+————+—————–+————+————+———————–+——————+——————+—————-+———————+——————–+————–+————+————–+
| Host | Db | User | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Create_tmp_table_priv | Lock_tables_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Execute_priv | Event_priv | Trigger_priv |
+——+———+——+————-+————-+————-+————-+————-+———–+————+—————–+————+————+———————–+——————+——————+—————-+———————+——————–+————–+————+————–+
| % | test | | Y | Y | Y | Y | Y | Y | N | Y | Y | Y | Y | Y | Y | Y | Y | N | N | Y | Y |
| % | test\_% | | Y | Y | Y | Y | Y | Y | N | Y | Y | Y | Y | Y | Y | Y | Y | N | N | Y | Y |
+——+———+——+————-+————-+————-+————-+————-+———–+————+—————–+————+————+———————–+——————+——————+—————-+———————+——————–+————–+————+————–+
2 rows in set (0.00 sec)

mysql> select * from user;

+————+——+——————+————-+————-+————-+————-+————-+———–+————-+—————+————–+———–+————+—————–+————+————+————–+————+———————–+——————+————–+—————–+——————+——————+—————-+———————+——————–+——————+————+————–+———-+————+————-+————–+—————+————-+—————–+———————-+
| Host | User | Password | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Create_user_priv | Event_priv | Trigger_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections |
+————+——+——————+————-+————-+————-+————-+————-+———–+————-+—————+————–+———–+————+—————–+————+————+————–+————+———————–+——————+————–+—————–+——————+——————+—————-+———————+——————–+——————+————+————–+———-+————+————-+————–+—————+————-+—————–+———————-+
| localhost | root | 39d1b8ab60ad963e | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 |
| p520-aix61 | root | 39d1b8ab60ad963e | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 |
| 127.0.0.1 | root | | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 |
| localhost | | | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | | | | | 0 | 0 | 0 | 0 |
| p520-aix61 | | | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | | | | | 0 | 0 | 0 | 0 |
+————+——+——————+————-+————-+————-+————-+————-+———–+————-+—————+————–+———–+————+—————–+————+————+————–+————+———————–+——————+————–+—————–+——————+——————+—————-+———————+——————–+——————+————+————–+———-+————+————-+————–+—————+————-+—————–+———————-+
5 rows in set (0.00 sec)


10. Test shutting down the server:

# /opt/freeware/bin/mysqladmin shutdown -p

Enter password:
140516 9:18:07 [Note] /opt/freeware/libexec/mysqld: Normal shutdown

11. This is the main configuration file:

# cat /opt/freeware/etc/my.cnf

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1…..

..

12. Configure auto stop-start:

For some reason the example stop-start file is not correct so I had to create my own. Here is an example:

# cat > /etc/rc.d/init.d/mysqld

#!/usr/bin/ksh
#
# description: MySQL startup script
#

PIDFILE=/var/run/httpd.pid
MYSQLD_BIN=/opt/freeware/libexec/mysqld
USER=root
PASSWORD=Logger98

case “$1” in
start)
if [ -r $PIDFILE ]; then
print “MySQL daemon is already running with PID “$(cat $PIDFILE)”.”
exit 1
else
print “Starting MySQL…”

## Start daemon (writes PID to file $PIDFILE).
$MYSQLD_BIN &
ps -ef | grep -w mysqld | grep -v grep | awk ‘{print $2}’ > ${PIDFILE}
fi
;;
stop)
print “Shutting down MySQL daemon… ”
## Stop daemon.
if [ -r $PIDFILE ]; then
/opt/freeware/bin/mysqladmin shutdown -u $USER –password=$PASSWORD
rm -f $PIDFILE
fi
;;
status)
if [ -r $PIDFILE ]; then
print “MySQL daemon is running with PID “$(cat $PIDFILE)”.”
/opt/freeware/bin/mysqladmin status -u $USER –password=$PASSWORD
else
print “MySQL daemon is not running.”
ps -ef | grep -w “libexec/mysqld” | grep -v grep
fi
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
;;
*)
print “Usage: $0 {start|stop|status|restart}”
exit 1
;;
esac

13-11-2015
Related