Difference between revisions of "MYSQL"

From Earlham CS Department
Jump to navigation Jump to search
 
Line 2: Line 2:
  
 
hopperprime#  
 
hopperprime#  
 +
 
cd /usr/ports/databases/mysql50-server/
 
cd /usr/ports/databases/mysql50-server/
make
+
 
make install
+
make; make install
  
  
 
----
 
----
 
'''Remember to run mysql_upgrade (with the optional --datadir=<dbdir> flag)
 
'''Remember to run mysql_upgrade (with the optional --datadir=<dbdir> flag)
 +
 
the first time you start the MySQL server after an upgrade from an
 
the first time you start the MySQL server after an upgrade from an
 
earlier version.'''
 
earlier version.'''
Line 15: Line 17:
 
       This port has installed the following files, which may act as network
 
       This port has installed the following files, which may act as network
 
       servers and may therefore pose a remote security risk to the system.
 
       servers and may therefore pose a remote security risk to the system.
 +
 
/usr/local/libexec/mysqld
 
/usr/local/libexec/mysqld
 +
  
 
       This port has installed the following startup scripts, which may cause
 
       This port has installed the following startup scripts, which may cause
 
       these network services to be started at boot time.
 
       these network services to be started at boot time.
 +
 
/usr/local/etc/rc.d/mysql-server
 
/usr/local/etc/rc.d/mysql-server
  
Line 26: Line 31:
  
 
'''Note: this must be done under the mysql user or use --user=mysql'''
 
'''Note: this must be done under the mysql user or use --user=mysql'''
 +
 
/usr/local/bin/mysql_install_db --user=mysql
 
/usr/local/bin/mysql_install_db --user=mysql
 
  
 
'''set the root password'''
 
'''set the root password'''
Line 36: Line 41:
  
 
hopperprime# mysqlshow -u root
 
hopperprime# mysqlshow -u root
 +
 
mysqlshow: Access denied for user 'root'@'localhost' (using password: NO)
 
mysqlshow: Access denied for user 'root'@'localhost' (using password: NO)
 +
 
hopperprime# mysqlshow -u root -p
 
hopperprime# mysqlshow -u root -p
 +
 
Enter password:
 
Enter password:
<nowiki>
+
 
+--------------------+
+
{| border="1" cellspacing="0" cellpadding="5" align="center"
|     Databases      |
+
! Database
+--------------------+
+
|-  
| information_schema |
+
|information_schema
| mysql             |
+
|-
| test               |
+
|mysql
+--------------------+
+
|-
</nowiki>
+
|test
 +
|}
 +
 
 
also set the root @localhost password
 
also set the root @localhost password
  
  
 
hopperprime# mysql -u root -p
 
hopperprime# mysql -u root -p
 +
 
Enter password:
 
Enter password:
 +
 
Welcome to the MySQL monitor.  Commands end with ; or \g.
 
Welcome to the MySQL monitor.  Commands end with ; or \g.
 +
 
Your MySQL connection id is 8
 
Your MySQL connection id is 8
 +
 
Server version: 5.0.41 FreeBSD port: mysql-server-5.0.41
 
Server version: 5.0.41 FreeBSD port: mysql-server-5.0.41
  
Line 60: Line 74:
  
 
mysql> select host, user from mysql.user;
 
mysql> select host, user from mysql.user;
<nowiki>
+
 
+---------------------------------+------+
+
{| border="1" cellspacing="0" cellpadding="5" align="center"
| host                           | user |
+
! host
+---------------------------------+------+
+
! user
| 127.0.0.1                      | root |
+
|-  
| hopperprime.cluster.earlham.edu | root |
+
|127.0.01
| localhost                       | root |
+
|root
+---------------------------------+------+
+
|-
</nowiki>
+
|hopperprime.cluster.earlham.edu
 +
|root
 +
|-
 +
|localhost
 +
|root
 +
|}
 
3 rows in set (0.00 sec)
 
3 rows in set (0.00 sec)
  
mysql> SET PASSWORD FOR 'root'@'hopperprime.cluster.earlham.edu' = PASSWORD('passwordhere');
+
mysql> SET PASSWORD FOR 'root'@'hopperprime.cluster.earlham.edu' =  
 +
 
 +
PASSWORD('passwordhere');
 +
 
 
Query OK, 0 rows affected (0.00 sec)
 
Query OK, 0 rows affected (0.00 sec)
  
Line 82: Line 104:
  
 
----
 
----
 +
'''Also install p5-DBD-mysql'''
  
 
hopperprime# locate p5-DBD-mysql
 
hopperprime# locate p5-DBD-mysql
 +
 
cd /usr/ports/databases/p5-DBD-mysql
 
cd /usr/ports/databases/p5-DBD-mysql
  
Line 89: Line 113:
  
 
----
 
----
 +
'''Also install php5-mysql'''
 +
hopperprime# locate php5-mysql
  
hopperprime# locate php5-mysql
 
 
cd /usr/ports/databases/php5-mysql
 
cd /usr/ports/databases/php5-mysql
 +
 
make; make install
 
make; make install
hopperprime# make install
 
===>  Installing for php5-mysql-5.2.2
 
===>  php5-mysql-5.2.2 depends on file: /usr/local/include/php/main/php.h - found
 
===>  php5-mysql-5.2.2 depends on shared library: mysqlclient.15 - found
 
===>  Generating temporary packing list
 
===>  Checking if databases/php5-mysql already installed
 
===>  Registering installation for php5-mysql-5.2.2
 
 
----
 
  
The following line has been added to your /usr/local/etc/php/extensions.ini
+
this install adds the following line to /usr/local/etc/php/extensions.ini
 
configuration file to automatically load the installed extension:
 
configuration file to automatically load the installed extension:
  
 
extension=mysql.so
 
extension=mysql.so
 +
 
----
 
----
  
 
hopperprime# pkg_info | grep mysql
 
hopperprime# pkg_info | grep mysql
 +
 
mysql-client-5.0.41 Multithreaded SQL database (client)
 
mysql-client-5.0.41 Multithreaded SQL database (client)
 +
 
mysql-server-5.0.41 Multithreaded SQL database (server)
 
mysql-server-5.0.41 Multithreaded SQL database (server)
 +
 
p5-DBD-mysql-4.003  MySQL driver for the Perl5 Database Interface (DBI)
 
p5-DBD-mysql-4.003  MySQL driver for the Perl5 Database Interface (DBI)
 +
 
php5-mysql-5.2.2    The mysql shared extension for php
 
php5-mysql-5.2.2    The mysql shared extension for php

Latest revision as of 17:36, 4 June 2007

Destructions for setting up MySQL on hopperprime

hopperprime#

cd /usr/ports/databases/mysql50-server/

make; make install



Remember to run mysql_upgrade (with the optional --datadir=<dbdir> flag)

the first time you start the MySQL server after an upgrade from an earlier version.


     This port has installed the following files, which may act as network
     servers and may therefore pose a remote security risk to the system.

/usr/local/libexec/mysqld


     This port has installed the following startup scripts, which may cause
     these network services to be started at boot time.

/usr/local/etc/rc.d/mysql-server

More information can be found at http://www.mysql.com/

first time install you need configure the mysql database tables

Note: this must be done under the mysql user or use --user=mysql

/usr/local/bin/mysql_install_db --user=mysql

set the root password

mysqladmin -u root -h hopperprime.cluster.earlham.edu password passwdhere

test to make sure the password is set.

hopperprime# mysqlshow -u root

mysqlshow: Access denied for user 'root'@'localhost' (using password: NO)

hopperprime# mysqlshow -u root -p

Enter password:

Database
information_schema
mysql
test

also set the root @localhost password


hopperprime# mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 8

Server version: 5.0.41 FreeBSD port: mysql-server-5.0.41

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select host, user from mysql.user;

host user
127.0.01 root
hopperprime.cluster.earlham.edu root
localhost root

3 rows in set (0.00 sec)

mysql> SET PASSWORD FOR 'root'@'hopperprime.cluster.earlham.edu' =

PASSWORD('passwordhere');

Query OK, 0 rows affected (0.00 sec)

mysql>quit

also add mysql_enable="YES" to /etc/rc.conf

mysql is now installed



Also install p5-DBD-mysql

hopperprime# locate p5-DBD-mysql

cd /usr/ports/databases/p5-DBD-mysql

make; make install


Also install php5-mysql hopperprime# locate php5-mysql

cd /usr/ports/databases/php5-mysql

make; make install

this install adds the following line to /usr/local/etc/php/extensions.ini configuration file to automatically load the installed extension:

extension=mysql.so


hopperprime# pkg_info | grep mysql

mysql-client-5.0.41 Multithreaded SQL database (client)

mysql-server-5.0.41 Multithreaded SQL database (server)

p5-DBD-mysql-4.003 MySQL driver for the Perl5 Database Interface (DBI)

php5-mysql-5.2.2 The mysql shared extension for php