Solved

help activate database on Linux redhat 7.2

Posted on 2002-06-21
10
248 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
Comment Utility
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
Comment Utility
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
Comment Utility
Also, what drivers should I download for mysql to be running with perl and java ?
Thanks.
0
 
LVL 3

Expert Comment

by:DVB
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 3

Expert Comment

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

Accepted Solution

by:
MFCRich earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

771 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now