?
Solved

help activate database on Linux redhat 7.2

Posted on 2002-06-21
10
Medium Priority
?
267 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
  • 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
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
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 400 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 Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Fine Tune your automatic Updates for Ubuntu / Debian
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
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.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month15 days, 12 hours left to enroll

850 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