Showing posts with label Mysql. Show all posts
Showing posts with label Mysql. Show all posts

Friday, 22 January 2010

Running a syntax check on /etc/my.cnf

To verify the my.cnf parameter changes

/usr/libexec/mysqld –help –verbose

Finding out versions of java, apache , php and mysql

Hi,

Use the following to find out the version info

java -version
java version “1.6.0_03″
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Server VM (build 1.6.0_03-b05, mixed mode)

php -v
PHP 4.3.9 (cgi) (built: Apr 17 2009 19:13:06)
Copyright (c) 1997-2004 The PHP Group

mysql -V
mysql Ver 14.7 Distrib 4.1.22, for redhat-linux-gnu (i686) using readline 4.3

httpd -v
Server version: Apache/2.0.52

Hope this will help you to determine the versions of the softwares.


You can visit my second blog : devenix.wordpress.com

Mysql and C API

//Just a simple example to show that we can work with mysql using c language

// Happy programming
#include
#include
#include

static char *opt_host_name = “yourip”; //eg 192.168.0.254
static char *opt_user_name = “userdatabase”;
static char *opt_password = “userpassword”;
static unsigned int opt_port_num = 3306;
static char *opt_socket_name = NULL;
static char * opt_db_name = “dbname”;
static unsigned int opt_flags = 0;

static MYSQL *conn;

int main(int argc, char *argv[])
{
conn = mysql_init(NULL);

if(conn == NULL)
{
fprintf(stderr,”mysql init() failed\n”);
exit(1);
}

if(mysql_real_connect(conn,opt_host_name,opt_user_name,opt_password,

opt_db_name,opt_port_num,opt_socket_name,opt_flags) == NULL)
{
fprintf(stderr,”mysql_real_connect() failed\n”);
mysql_close(conn);
exit(1);

}
else
{
printf(“connected to mysql server on:%s\t”,opt_host_name);
}

mysql_close(conn);
return 0;
}