Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts

Thursday, January 16, 2014

Update to: Building PHP 5

this post is an update to: Building Apache 2 and Php 5 from source

after building apache and php following the steps described in the link above, i noticed that when trying to access a mysql database from a php script that the mysqli was not available. the problem was that i did not configure php correctly. i have fixed that with the steps below.

i have included the php build section for context. the only changes are in the parameters to the configure script.


configure and build PHP. configure with Apache 2 and MySQL support.
since apache was built from source, the steps below will match the path for apxs.
cd ../php-NN
./configure --with-apxs2=/usr/local/apache2/bin/apxs 
            --with-mysql=/usr/local/mysql 
            --with-mysqli=mysqlnd
make
make test
make install 
 
 

Tuesday, October 22, 2013

Building Mysql 5.5 from source

following are the steps I used to build from source and install mysql 5.5 on my debian system

download the Mysql 5.5 tarball from mysql.com . become the root user and move the downloaded tarball to /usr/local/src. unpack the mysql tarball with:
tar -xvzf mysql-5.5.xx.tar.gz

add specific user and group to run mysql as:
groupadd mysql
useradd -r -g mysql mysql 

change directory to be inside source tree
cd /usr/local/src/mysql-5.5.xx

execute make commands
cmake .
make
make install

change to install directory
cd /usr/local/mysql

execute post installation setup commands
chown -R mysql .
chgrp -R mysql .
scripts/mysql_install_db --user=mysql
chown -R root .
chwon -R mysql data
cp support-files/my-medium.cnf /etc/my.cnf
bin/mysqld_safe --user=mysql &
cp support-files/mysql.server /etc/init.d/mysql.server

login to mysql command line client and set passwords
mysql -u root -p
enter root password when prompted

display existing users
SELECT User, Host, Password FROM mysql.user;

assign password to the root user
UPDATE mysql.user SET Password = PASSWORD('newpassword') 
    WHERE User = 'root';
FLUSH PRIVILEGES;

assign password to the anonymous user
UPDATE mysql.user SET Password = PASSWORD('newpassword')  
    WHERE User = '';
FLUSH PRIVILEGES;

display existing users to verify passwords have been set
SELECT User, Host, Password FROM mysql.user;


exit mysql command line client
quit

add non-root user to mysql group
usermod -a -G mysql myUsername

add symlink to access mysql and mysqladmin
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
ln -s /usr/local/mysql/bin/mysqladming /usr/bin/mysqladmin



info taken from:
http://dev.mysql.com/doc/refman/5.5/en/installing-source-distribution.html