Difference between revisions of "MYSQL"

From Earlham CS Department
Jump to navigation Jump to search
(Installing Mysql on Hopperprime)
 
Line 6: Line 6:
 
make install
 
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.'''
************************************************************************
+
----
  
 
       This port has installed the following files, which may act as network
 
       This port has installed the following files, which may act as network
Line 38: Line 39:
 
hopperprime# mysqlshow -u root -p
 
hopperprime# mysqlshow -u root -p
 
Enter password:
 
Enter password:
 +
<nowiki>
 
+--------------------+
 
+--------------------+
 
|    Databases      |
 
|    Databases      |
Line 45: Line 47:
 
| test              |
 
| test              |
 
+--------------------+
 
+--------------------+
 
+
</nowiki>
 
also set the root @localhost password
 
also set the root @localhost password
  
Line 58: Line 60:
  
 
mysql> select host, user from mysql.user;
 
mysql> select host, user from mysql.user;
 +
<nowiki>
 
+---------------------------------+------+
 
+---------------------------------+------+
 
| host                            | user |
 
| host                            | user |
Line 65: Line 68:
 
| localhost                      | root |
 
| localhost                      | root |
 
+---------------------------------+------+
 
+---------------------------------+------+
 +
</nowiki>
 
3 rows in set (0.00 sec)
 
3 rows in set (0.00 sec)
  
Line 96: Line 100:
 
===>  Checking if databases/php5-mysql already installed
 
===>  Checking if databases/php5-mysql already installed
 
===>  Registering installation for php5-mysql-5.2.2
 
===>  Registering installation for php5-mysql-5.2.2
****************************************************************************
+
 
 +
----
  
 
The following line has been added to your /usr/local/etc/php/extensions.ini
 
The following line has been added to your /usr/local/etc/php/extensions.ini
Line 102: Line 107:
  
 
extension=mysql.so
 
extension=mysql.so
 
****************************************************************************
 
 
 
----
 
----
  

Revision as of 16:27, 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: +--------------------+ | Databases | +--------------------+ | 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.0.1 | 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



hopperprime# locate p5-DBD-mysql cd /usr/ports/databases/p5-DBD-mysql

make; make install


hopperprime# locate php5-mysql cd /usr/ports/databases/php5-mysql 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 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