LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-08-2003, 12:08 AM   #1
Bigun
Member
 
Registered: Aug 2002
Location: Hickville, TN
Distribution: Gentoo > current. Have used: Red Hat 7.3, 9, Gentoo 1.4
Posts: 400

Rep: Reputation: 30
A few minor MySQL questions


I'm using RH 7.3. I'm a newbie to SQL and reading a book on it. I would like to follow along the examples in the book so I can learn the syntax.

So how do I start the MySQL Server?

How do I log in?

And before I get flamed, is there a good beginners page for MySQL?

Thanks for helping a !!
 
Old 06-08-2003, 12:13 AM   #2
Muddy
Member
 
Registered: May 2002
Location: Ohio
Distribution: Mandrake 9.2 Custom Kernel & Mythtv!
Posts: 256

Rep: Reputation: 30
in RH you can start mysql buy going into /etc/rc.d/init.d and using the "./mysqld start" command as root
you can also go (as root) into /sbin and run ./netsysv and use that to setup mysql to startup @ bootup.
 
Old 06-08-2003, 02:10 AM   #3
Robert0380
LQ Guru
 
Registered: Apr 2002
Location: Atlanta
Distribution: Gentoo
Posts: 1,280

Rep: Reputation: 47
it may be best to use safe_mysqld:

as root:

#safe_mysqld &

if you have the default configuration (installed from the rh7.3 cd)
then u log in by doing:

#mysql -uroot

and hit enter. if there is a root password that you set, then it's:

#mysql -uroot -p

and it will prompt you for password information

not sure of a beginners page, maybe just check ont www.mysql.com for docs
and info. If you know SQL then its not hard to figure out what you are doing,
but knowing some of the mysql specific commands is great and make sure
you know about mysqladmin stuff. it should all be on the mysql website.
 
Old 06-08-2003, 09:50 AM   #4
Bigun
Member
 
Registered: Aug 2002
Location: Hickville, TN
Distribution: Gentoo > current. Have used: Red Hat 7.3, 9, Gentoo 1.4
Posts: 400

Original Poster
Rep: Reputation: 30
Ok, it works, I can now log in. Now how would I password protect certain databases or certain permissions to databases?
 
Old 06-08-2003, 04:02 PM   #5
Bigun
Member
 
Registered: Aug 2002
Location: Hickville, TN
Distribution: Gentoo > current. Have used: Red Hat 7.3, 9, Gentoo 1.4
Posts: 400

Original Poster
Rep: Reputation: 30
Is anyone here really familiar with setting up MySQL? I looked over the manual pages at MySQL.com and they read like Greek. It's nice that they elaborate what every little option does and all, but I'd like to know how to get it started for now. I just need to understand how to setup permissions to users in MySQL and how to log into it remotely. Would anyone know how to do this?
 
Old 06-08-2003, 05:04 PM   #6
Robert0380
LQ Guru
 
Registered: Apr 2002
Location: Atlanta
Distribution: Gentoo
Posts: 1,280

Rep: Reputation: 47
oh the EASIEST way to do this is with webmin

BUT

the hard way (not REALLY hard but takes some patience)
is to add entries to the mysql database

the mysql database is what holds host/user permissions

when you log in to mysql, log in as root and do this to look at the
table:


mysql>\u mysql;

it will say database changed..blah blah

mysql>show tables;

this will show you the tables...

mysql>desc user;

this whill show you the fields in the user table;

and example of how to add a user:

mysql>insert into user(Host, User,.....)
-->values('localhost','usrername'.....);

that's how u would add users..

make sure you encrypt passwords, to do this you can use the
password function

insert into.....(Password)
vaules(password('password'));

that will store the password in an encrypted form.


like i said tho the easiest way is using webmin....webmin lets you
fill in a few fields and click the Add button. it uses a web based interface

http://webmin.com
 
Old 06-09-2003, 09:38 AM   #7
Bigun
Member
 
Registered: Aug 2002
Location: Hickville, TN
Distribution: Gentoo > current. Have used: Red Hat 7.3, 9, Gentoo 1.4
Posts: 400

Original Poster
Rep: Reputation: 30
Ok, this Webmin thing would seem to be the way to go with a lot of things on Linux....very cool tool. But I think I may have made the situation worse. I went in and added passwords to the root accounts in mysql and now it won't let me have access to the mysql accounts. And yes I am logged in as root.

Suggestions?
 
Old 06-09-2003, 10:59 AM   #8
Pete Dogg
Member
 
Registered: May 2003
Location: Ontario, Canada
Distribution: Mandrake 9.0, RedHat 7.3, Mandrake 9.2
Posts: 178

Rep: Reputation: 31
A simple way to create a database and a user is as follows:


mysql --user=root

mysql> CREATE DATABASE mydb;
mysql> GRANT ALL PRIVILEGES ON *.* TO mynewuser@localhost IDENTIFIED BY 'mypassword';


now to specify the privileges you want, you can look up the documentation at mysql.com. Search for GRANT.
In a lot of cases you don't always want to grant all privileges. You may want to grant only select only on one database.
eg)
GRANT SELECT ON mydb.* TO mynewuser@localhost IDENTIFIED BY 'mypassword';

To remove privileges use the REVOKE command.


I think this is the information you are looking for.
 
Old 06-09-2003, 11:10 PM   #9
Bigun
Member
 
Registered: Aug 2002
Location: Hickville, TN
Distribution: Gentoo > current. Have used: Red Hat 7.3, 9, Gentoo 1.4
Posts: 400

Original Poster
Rep: Reputation: 30
Well, pending recent circumstances, it has deamed beneficial for me to install RH 9 and try it out. If it stinks, I'll go back to RH 7.3. Either way I'll get everything reset. One of the reasons for doing so was because I could not access mysql anymore. Setting the password for the root username under SQL really screwed things up. I tried uninstalling the RPM and re-installing it. It still wouldn't let me in. This coupled with the fact that I couldn't play the latest version of MAME (What can I say, I'm a gaming addict! ), I will try RH 9.

In the meanwhile I guess I could do some reading on the next part of my learning SQL whilst I wait on the approximately 2 gig download. So my question is this:

I want to use this SQL database with a webpage. So this actually will lead to two questions. How would I make a webpage interact with a SQL database (a web page tutorial for me to read would be fine), and second, what program in Linux would be best to create a webpage that will use the SQL database.
 
Old 06-10-2003, 01:35 AM   #10
Pete Dogg
Member
 
Registered: May 2003
Location: Ontario, Canada
Distribution: Mandrake 9.0, RedHat 7.3, Mandrake 9.2
Posts: 178

Rep: Reputation: 31
Most people nowadays use PHP to build a website that can interact with a MySQL (or any) database.

The functions for connecting to MySQL with PHP are here:
http://www.php.net/mysql

I don't know any good tutorials on PHP, hopefully someone else can post that.

You can create php webpages using any text editor. As for what program is the best, I don't know. On windows I like using Dreamweaver. But it's not free.
 
Old 06-10-2003, 10:04 AM   #11
Bigun
Member
 
Registered: Aug 2002
Location: Hickville, TN
Distribution: Gentoo > current. Have used: Red Hat 7.3, 9, Gentoo 1.4
Posts: 400

Original Poster
Rep: Reputation: 30
Oh, that reminds me, what port does SQL typically communicate through?
 
Old 06-13-2003, 01:01 AM   #12
Robert0380
LQ Guru
 
Registered: Apr 2002
Location: Atlanta
Distribution: Gentoo
Posts: 1,280

Rep: Reputation: 47
3306 i think
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
More php and mysql questions nazdrowie Programming 1 12-13-2004 06:36 PM
path and mysql questions Red Squirrel Linux - Newbie 13 03-07-2004 03:16 PM
Mysql - phpMyadmin questions paleogryph Linux - Software 1 02-27-2004 12:47 PM
MySQL questions Thinkgeekness Linux - Software 3 04-08-2003 09:04 PM
Just a couple of minor Boot questions... Bob Taylor Linux - General 3 03-17-2003 05:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration