See also A clean install or upgrade under Solaris.
See http://www.howtoforge.com/quick-n-easy-lamp-server-centos-rhel.
yum install mysql mysql-server mysql-devel /etc/init.d/mysqld start
~mysql/.my.cnf
:
[client] user=root password=XXXXXXSecure the database:
/usr/bin/mysql_secure_installation
xxxxxxx
password is the same as above, which is in ~mysql/.my.cnf
yyyyyyy
password is found in ~apache/.mysqlpwd
zzzzzzz
password is found in ~apache/conf.php
aaaaaaa
password is found in ~apache/conf.php
root@moog www]# /usr/bin/mysql --user=root -p mysql /usr/bin/mysql --user=root -p mysql Enter password: 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 10 Server version: 5.1.61 Source distribution Copyright (c) 2000, 2011, 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> GRANT ALL PRIVILEGES ON *.* TO 'apache'@'localhost' GRANT ALL PRIVILEGES ON *.* TO 'apache'@'localhost' -> IDENTIFIED BY 'yyyyyyy' WITH GRANT OPTION; IDENTIFIED BY 'yyyyyy' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON *.* TO 'apache'@'%' GRANT ALL PRIVILEGES ON *.* TO 'apache'@'%' -> IDENTIFIED BY 'yyyyyyy' WITH GRANT OPTION; IDENTIFIED BY 'yyyyyyy' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON *.* TO 'dbreader'@'localhost' -> IDENTIFIED BY 'zzzzzzzz' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON *.* TO 'dbapplyuser'@'localhost' -> IDENTIFIED BY 'aaaaaaaa' WITH GRANT OPTION; mysql> FLUSH PRIVILEGES FLUSH PRIVILEGES -> ; ; Query OK, 0 rows affected (0.00 sec) mysql> exit exit Bye [root@moog www]#
/usr/bin/mysqldump -u root -p mysqlThe output will be voluminous, look for apache in the output.
/etc/my.cnf
:
# Configuration file for MySQL [client] [mysqld] datadir=/home/www/mysql log=/home/www/mysql/mysql_log log-update=/home/www/mysql/mysql_update_log socket=/var/lib/mysql/mysql.sock user=mysql symbolic-links=0 [mysqldump] #[mysqld] #datadir=/var/lib/mysql #socket=/var/lib/mysql/mysql.sock #user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks #symbolic-links=0 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pidAt this point, do:
mkdir -p /home/www/mysql chown mysql /home/www/mysql
/etc/init.d/mysqld start
[root@moog www]# mysql --user=root -p mysql mysql --user=root -p mysql Enter password: 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 14 Server version: 5.1.61 Source distribution Copyright (c) 2000, 2011, 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> exit exit Bye [root@moog www]#
mysql
user and group.
pkgrm mysql rm -rf /opt/mysql /var/lib/mysql mv /etc/my.cnf /etc/my.cnf.old
su - mysql mkdir /home/www/mysqlarchive/mysqlupgrade cd /home/www/mysqlarchive/mysqlupgrade /home/www/php/util/mysqldumpall exit cp /etc/my.cnf /etc/my.cnf.oldNote that
/etc/my.cnf
will control the
directories in which the mysql_install_db
command works.
pkgadd method: For Solaris, download the 32 bit package from
http://www.mysql.com.
I downloaded mysql-5.1.53-solaris10-sparc.tar.gz
.
gunzip mysql-5.0.67-solaris10-sparc.pkg.gz pkgadd -d mysql-5.0.67-solaris10-sparc.pkg.gzThis will create
/opt/mysql
tar method: For Solaris, download the 32 bit .tar.gz
from
http://www.mysql.com.
I downloaded mysql-5.1.53-solaris10-sparc.tar.gz
.
cd /opt/mysql gtar -zxf /home/tools/downloads/mysql-5.1.53-solaris10-sparc.tar.gz rm mysql ln -s mysql-5.1.53 mysqlThis will create
/opt/mysql
See /opt/mysql/mysql/INSTALL_BINARY
for the steps necessary:
cd /opt/mysql/mysql chown -R mysql . chgrp -R mysql .
If the next steps fail, it could be that /etc/my.cnf
or ~mysql/.my.cnf
are causing problems.
You might want to temporarily move /etc/my.cnf
.
Initial Install:Try running:
/opt/mysql/mysql/scripts/mysql_install_db --user=mysql --ldata=/home/www/mysql --datadir=/home/www/mysql --force chown -R root . chown -R mysql data /opt/mysql/mysql/bin/mysqld_safe --user=mysql --datadir=/home/www/mysql --verbose &
Or Upgrade: Upgrade the server
/etc/init.d/mysql.server stop /etc/init.d/mysql.server start su - mysql cd /opt/mysql/mysql bin/mysql_upgradeTry out the website, bring it down and back up
/etc/init.d/gsrc stop /etc/init.d/gsrc start
mysqld_safe
is running, set
the password. The ~mysql/.my.cnf
should look like
[client] user=root password=xxxxxxx
/opt/mysql/mysql/bin/mysqladmin -u root password 'xxxxxxx' /opt/mysql/mysql/bin/mysqladmin -u root -h carson.EECS.Berkeley.EDU password 'xxxxxxx'
/usr/sfq/bin/mysql
is not the binary to run, instead run
/opt/mysql/mysql/bin/mysql
xxxxxxx
password is the same
as above, which is in ~mysql/.my.cnf
yyyyyyy
password is found in
~apache/.mysqlpwd
carson.EECS.Berkeley.EDU:root: %C2> /opt/mysql/mysql/bin/mysql --user=root -p mysql Enter password: xxxxxx 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 10 Server version: 5.0.45 MySQL Community Server (GPL) Type 'help;' or 'h' for help. Type 'c' to clear the buffer. mysql> GRANT ALL PRIVILEGES ON *.* TO 'apache'@'localhost' -> IDENTIFIED BY 'yyyyyy' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON *.* TO 'apache'@'%' -> IDENTIFIED BY 'yyyyyy' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES -> ; Query OK, 0 rows affected (0.00 sec) mysql> exit Bye carson.EECS.Berkeley.EDU:root: %C2>
/usr/local/mysql/bin/mysqldump -u root -p mysqlThe output will be voluminous, look for apache in the output.
/etc/my.cnf
:
# Configuration file for MySQL [client] [mysqld] datadir=/home/www/mysql log=/home/www/mysql/mysql_log log-update=/home/www/mysql/mysql_update_log [mysqldump]
/etc/init.d/mysql start
carson.EECS.Berkeley.EDU:root: %C2> /opt/mysql/mysql/bin/mysql --user=root -p mysql Enter password: yyyyyyy 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 2 Server version: 5.0.45-log MySQL Community Server (GPL) Type 'help;' or 'h' for help. Type 'c' to clear the buffer. mysql> exit Bye carson.EECS.Berkeley.EDU:root: %C2>
dbreader
:
In phpMyAdmin, from the home page, go to "Privileges" to add the user.
Then edit /home/apache/conf.php.
Then cvs-update php/include/sql.inc.php, which uses the select-only user for all select-only functions.
/home/apache/conf.php
now has lines like:
$db_select_user = 'dbreader'; $db_select_pass = 'Thepassword';
php.err
contains
Call to undefined function mysqli_connect() in /export/home/www/php/include/sql.inc.php on line 435
Solution: edit /usr/local/lib/php.ini
and uncomment
/opt/mysql/mysql/data/carson.EECS.Berkeley.EDU.err
contains
070509 19:03:27 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't existSolution: Use
/etc/init.d/mysql
instead of
/etc/init.d/mysql.server
. Note that
the gsrc
script should be updated.
These are allenh's notes from upgrading MYSQL in June, 2002. Download MySQL's Solaris 2.8 binary package and simply copy the whole directory structure to be /usr/local/mysql-3.23.51.
Rename /usr/local/mysql/data to "data-" and make /usr/local/mysql/data a symbolic link to /home/www/mysql.
Mkdir /usr/local/mysql/lib/mysql, and copy /usr/local/mysql-3.22.23/lib/mysql/libmysqlclient.so.6 there. (I think this file will not be required by the upgraded Apache.)
Bring the website down as root:
$ /etc/init.d/gsrc stop
Create a symbolic link named /usr/local/mysql that points to /usr/local/mysql-3.23.51.
Bring the website up as root:
$ /etc/init.d/gsrc start
Check the website functionality. Should be unchanged.
MySQL is an open-source SQL database that consistently receives high recommendations for its reliability, performance, and of course, price. It is the most commonly-used database with PHP-enabled Web servers (like ours), which makes writing and porting PHP code simpler.
Installation Slightly updated in June, 2005. Solaris 10 binaries of 3.23 are not available, so we rebuild from source
http://downloads.mysql.com/archives.php
/usr/local/mysql/bin/mysqladmin -h localhost -u root -p shutdownSee MySQL passwords FAQ for information about passwords.
Create a mysql user and group. /etc/passwd
:
mysql:x:2813:104:MySQL user at www.gigascale.org:/home/mysql:/bin/shUpdate
/etc/shadow
:
mysql:xxxxxxxxx:12299::::::Update
/etc/group
:
mysql::104:Create the dot files for the mysql user
mkdir /home/mysql cp /usr/cluster/lib/userhome/.??* /home/mysql chown -R mysql /home/mysql
cd /home/www mkdir mysql chown mysql mysql chgrp mysql mysql chmod 700 mysql
From now on, you should not need to be root to install.
See the Solaris Notes section of the mysql manual
You should be able to complete this installation if you are in the permissions group staff.
cd /home/tools/mysql-3.23.xxx CC=gcc CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql-3.23.58 --localstatedir=/home/www/mysql --with-low-memory --enable-assembler make make install
Note: if you get an error complaining about /usr/include/term.h, comment out the line
#define HAVE_TERM_H 1from config.h and try again.
/usr/local/mysql/bin/mysql_install_db
/usr/local/mysql/bin/safe_mysqld &
Change the password. See MySQL Password FAQ for the password.
/usr/local/mysql/bin/mysqladmin -u root password "xxxx" /usr/local/mysql-3.23.58/bin/mysqladmin -u root -h gigascale.EECS.Berkeley.EDU password "xxxx"
yyyyyyy
password is found in
~apache/.mysqlpwd
andrews.EECS.Berkeley.EDU:root: /home/apache> mysql --user=root -p mysql Enter password: XXXX 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 2 to server version: 3.23.58-log Type 'help;' or 'h' for help. Type 'c' to clear the buffer. mysql> GRANT ALL PRIVILEGES ON *.* TO 'apache'@'localhost' -> IDENTIFIED BY 'yyyyyyy' WITH GRANT OPTION; Query OK, 0 rows affected (0.01 sec) mysql> GRANT ALL PRIVILEGES ON *.* TO 'apache'@'%' -> IDENTIFIED BY 'yyyyyyy' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.01 sec) mysql> exit Bye andrews.EECS.Berkeley.EDU:root: /home/apache>To verify that the apache user has been added run:
/usr/local/mysql/bin/mysqldump -u root -p mysql
# Configuration file for MySQL [client] [mysqld] log=/home/www/mysql/mysql_log log-update=/home/www/mysql/mysql_update_log [mysqldump]
You may need to be root to do this, unless your system is configured to give write permission to staff in /usr/local/bin, /usr/local/lib/perl5, and /usr/local/man. See How do I add a package to Perl
Note that to build DBI, I had to
perl -MCPAN -e shell install DBI install DBD cd /export/home1/root/.cpan/build/DBI-1.48 make OPTIMIZE=-O3 CCCDLFLAGS=-fPIC CCFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TS_ERRNO" make install cd ../DBD-mysql-2.9007 make OPTIMIZE=-O3 CCCDLFLAGS=-fPIC CCFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TS_ERRNO" make install
cd /export/home/tools/mysql-3.23.58/sql-bench ./run-all-tests -user root -pass "xxxxx"
http://www.gigascale.org/mysql
.
~www/php/mysql
.
RewriteRules
in
/usr/local/apache/conf/rewrite.conf
rewrite urls like http://www.gigascale.org/mysql
to
/home/www/php/mysql/
. Note that there are
several rewrite rules to handle the various file types.
Below are the instructions on how to update the phpMyAdmin
http://phpwizard.net/phpMyAdmin/
cd ~www/php/mysql cvs update cvs log
config.inc.php3
is probably the only modified
file
cd ~www/php cp -r mysql mysql_old_version_number
cd ~www/php/mysql cp -r /home/tools/phpMyAdmin
cp ../mysql_old_version_number/config.inc.php3 .
http://markov.eecs.berkeley.edu/mysql
cvs commit -m "Upgraded to version new_version_number"
cd ~www/php/mysql cvs update