Solved

help activate database on Linux redhat 7.2

Posted on 2002-06-21
10
255 Views
Last Modified: 2010-04-20
Im new to Linux. Got it installed and running.
How do I set up the database ? I read somewhere that Redhat 7.2 already comes with Opensql, postgres etc ?
Do i just have to activate it now ?
Can anyone help me, and point to some resources ?

Thanks.
0
Comment
Question by:chazhs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +2
10 Comments
 
LVL 4

Expert Comment

by:MFCRich
ID: 7099676
I'm not sure what OpenSQL is but RH 7.2 comes with PostgreSQL and MySQL. www.mysql.com has all kinds of info on MySQL but I don't have the URL for PostgreSQL handy.

Each of these has its own boot-time startup script in '/etc/init.d'. If you don't see either than you probably didn't install it so you'll have to go to your CDs.

Once its installed then (as root)

> chkconfig --level 345 <your SQL server> on

will start it at boot time. To start it manually

> /etc/init.d/<your SQL server> start

0
 

Author Comment

by:chazhs
ID: 7099719
Thanks, you are right, I seem to have Mysql. Although the file name is mysqld.

I just started it and here is the output :

 ./mysqld status
mysqld (pid 1272 1271 1270 1268) is running...

Now, how do I start working on it?
Where do I find the dbname, instance name, userid, password, port# etc. ?

The syntax for perl program to access db is something like this :

$Des_Dbh = DBI->connect ('DBI:Oracle:instancename', 'userid', 'passwd',{RaiseError=>0,
 AutoCommit=>0, PrintError=>0});

Thanks for your time!


0
 

Author Comment

by:chazhs
ID: 7099720
Also, what drivers should I download for mysql to be running with perl and java ?
Thanks.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:DVB
ID: 7100062
Postgres is available from http://www.postgresql.org/

The dbname is what you will create. The defaults should be in the documentation.

If you choose to install and use postgresql, then the basic ideas are:
#su - postgres
$createdb db
$psql db
=#create user 'user' with password 'password';
=#create table ();
=#\q
$exit
#

Install the Perl DBI, and the postgresql-jdbc rpm.

For perl:

#!/usr/bin/perl -w

use strict;
use DBI;

my $dbi = DBI->connect(DBI::Pg,.....);

man DBI, and man DBD::Pg.

ORA and Wrox press both have good books on Postgres, New riders has a good MySQL book. ORA has a book on Programming the Perl DBI.
google is your friend, as usual.
0
 

Author Comment

by:chazhs
ID: 7100141
I did activate mysql.

wrote a small java program to access it from my pc(remotely) . Did not provide userid or password. just passed the database name and table name and ipaddress in my connect string.

Got this error
java.sql.SQLException: Server configuration denies access to data source

Does it mean that my linux box has some layer of protection due to which i am not able to remotely access the database ?
Im using redhad 7.2

Or is this error because I have not created any userid/passwd for the database ?
How do i create userid for the database? (Isn't userid for a user different from userid for a database?)

(Note, working directly on the linux box, i was able to do mysql, and create,update table commands
I could not try the java program directly on the box, because i had trouble with drivers. )

0
 
LVL 3

Expert Comment

by:DVB
ID: 7100179
MySQL has its own user database, the default user, IIRC is root.
0
 
LVL 4

Accepted Solution

by:
MFCRich earned 100 total points
ID: 7100952
A fresh install of mysql comes with a database called 'mysql'. This is where many of its administrative info is kept include users and their passwords. MySQL does not use linux's user database.

The big muckity-muck is called 'root' and I think his password is blank initially. He is only allowed to log in from the localhost by default. You should find the manual in '/usr/share/doc/mysql-<version>'.

For Perl you will need the 'perl-DBD-MySQL' package. I believe it comes with a description of the API (but don't quote me on that)
0
 

Author Comment

by:chazhs
ID: 7109342
Thanks very much! You are absolutely right, root had access only from local host. Found the manual from /usr/share, created new users and was able to query the database through my program running remotely.

Thanks very much for all your help, suggestions and advises. Thanks for your valuable  time!
Cheers!
chazhs
0
 

Expert Comment

by:laisaoliveira
ID: 8558906
hello chazhs,
can you please tell me which line in the configuration file, and were can i find this file
should i input the % to make the sql database accept  all remote access rather than only localhost.

how did you managed to do this?
thanks
0
 

Expert Comment

by:rajasree
ID: 8561025
Gosh, it has been so long, I dont remember the config stuff.

Here ist he sql command i used to gain access remotely.

Hope that helps.

mysql> GRANT ALL ON *.* TO root@'%'
                          -> IDENTIFIED BY `secret'
                          -> WITH GRANT OPTION;
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

742 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question