I have the need to install php5 and mysql 5 on a centos 4 server, so I found that the Centos Plus repository had this, and this is what I did to get these two working.

First check what is the version of the distro:

  1. cat /etc/*release*

Then make an update:

  1. yum update

After 496 package updates I’ve installed php5

  1. yum --enablerepo=centosplus install php

This were the installed packages:

  1. php-5.1.6-3.el4s1.10
  2. php-cli-5.1.6-3.el4s1.10
  3. php-common-5.1.6-3.el4s1.10

So I’ve created a info.php file, and restarted the apache server:

  1. echo "<?php phpinfo(); ?>" > /var/www/html/info.php && service httpd restart

It was working correctly, so the next thing was to have mysql 5 in it, so I did:

  1. yum --enablerepo=centosplus install mysql-server

I got some problems here, first I got this:

  1. Transaction Check Error: file /etc/my.cnf from install of mysql-libs-5.0.68-1.el4_6 conflicts with file from package mysql-4.1.22-2.el4
  2. file /usr/share/mysql/charsets/Index.xml from install of mysql-libs-5.0.68-1.el4_6 conflicts with file from package mysql-4.1.22-2.el4
  3. file /usr/share/mysql/charsets/README from install of mysql-libs-5.0.68-1.el4_6 conflicts with file from package mysql-4.1.22-2.el4
  4. file /usr/share/mysql/charsets/armscii8.xml from install of mysql-libs-5.0.68-1.el4_6 conflicts with file from package mysql-4.1.22-2.el4
  5. file /usr/share/mysql/charsets/ascii.xml from install of mysql-libs-5.0.68-1.el4_6 conflicts with file from package mysql-4.1.22-2.el4

So what I found was that yum was trying to install mysql.i386 but the architechture is x86_64, to fix this I had to specify the arch

  1. yum --enablerepo=centosplus install mysql.x86_64 mysql-server

After this I was able to install it, but when I tried to start the server I received some errors about error messages not right, I’ve checked the installed packages and it was installed mysqlclient10, so I removed the error messages problem disappeared, however I still couldn’t startup the server, checking at the logs I found this:

  1. InnoDB: Creating foreign key constraint system tables
  2. InnoDB: Foreign key constraint system tables created
  3. 091012 1118 InnoDB: Started; log sequence number 0 0
  4. 091012 1118 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
  5. 091012 1118 mysqld ended

To fix this I cleared the data dir, that had som files, this was in ‘/var/lib/mysql’ and after that I ran mysql_install_db:

  1. [root@prestant /]# cd /var/lib/mysql
  2. [root@prestant mysql]# rm -rf *
  3. [root@prestant mysql]# mysql_install_db --user=mysql -ldata=/var/lib/mysql
  4. [root@prestant mysql]# service mysqld start

After the server was up, I changed the root password and added a new user:

  1. [root@prestant mysql]# mysqladmin -u root password NEWPASSWORD
  2. [root@prestant mysql]# mysql -pNEWPASSWORD
  3. Welcome to the MySQL monitor. Commands end with ; or \g.
  4. Your MySQL connection id is 5
  5. Server version: 5.0.82sp1 Source distribution
  6. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  7. mysql> CREATE USER 'ivan'@'%' IDENTIFIED BY 'passhere';
  8. Query OK, 0 rows affected (0.00 sec)
  9. mysql> GRANT ALL PRIVILEGES ON *.* TO 'ivan'@'%' IDENTIFIED BY 'passhere' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
  10. Query OK, 0 rows affected (0.00 sec)
  11. mysql> CREATE USER 'ivan'@'localhost' IDENTIFIED BY 'passhere';
  12. Query OK, 0 rows affected (0.00 sec)
  13. mysql> GRANT ALL PRIVILEGES ON *.* TO 'ivan'@'localhost' WITH GRANT OPTION;
  14. Query OK, 0 rows affected (0.00 sec)
  15. mysql> flush privileges;
  16. Query OK, 0 rows affected (0.00 sec)
  17. mysql> exit
  18. Bye