Archive for the ‘MySQL’ Category

Call to undefined function mysql_connect

Tuesday, May 27th, 2008

To day I’m install php5 , apache and mysql, I dowload “php-5.2.6-Win32.zip”  installer packet and apache “apache_2.2.8-win32-x86-openssl-0.9.8g.msi” and then I’m download mysql server

1. Install apache  apache_2.2.8-win32-x86-openssl-0.9.8g.msi

2. Extract php-5.2.6-Win32.zip to c:\php\php5 ( I create new dir php5 contain php5 only).

3. Rename php.ini.dst to php.ini in c:\php\php5 then cut to c:\windows

4. Copy libmysql.dll in c:\php\php5 to c:windows\system32

5. Edit httpd.conf in  C:\apache2.2\conf\ add this line

# ==== Load Module PHP5 ======
LoadModule php5_module “C:/php5/php5apache2_2.dll”
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

6. Restart apache and create php.info() for test php installation.

7. Install Mysql Server and create file for test db.

<?php
$dbhost=”localhost”;
$dbuser=”root”;
$dbpassword=”1234″;
mysql_connect($dbhost,$dbuser,$dbpassword);
echo “Test MySQL”;
?>

After run this file error occur “Fatal error: Call to undefined function mysql_connect() in C:\apache2.2\htdocs\testDB.php on line 5

I’m back to php.ini and uncomment

extension=php_mysql.dll

You might also need to configure the extension_dir variable.

extension_dir = “C:\php\php5\ext”

Restart apache and run  execute file again

How to access MySQL server from shell prompt

Wednesday, March 19th, 2008

MySQL software includes myslq client. It is a text-based client for mysql, a SQL-based relationed database server.

syntax:

mysql -u mysql_user_name -p mysql_password -h mysql_server

-u mysql_user_name : Specify MySQL user name. User root only when connecting to local system.
-p mysql_password : Specify MySQL password , Employ the specified password when connecting to the database server. If a password is not supplied , it will be requested interactively.
-h mysql_server : Connect to the specified host remote or local server