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 :newbie: !!
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.
it may be best to use safe_mysqld:
if you have the default configuration (installed from the rh7.3 cd)
then u log in by doing:
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.
Ok, it works, I can now log in. Now how would I password protect certain databases or certain permissions to databases?
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?
oh the EASIEST way to do this is with webmin
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
it will say database changed..blah blah
this will show you the tables...
this whill show you the fields in the user table;
and example of how to add a user:
mysql>insert into user(Host, User,.....)
that's how u would add users..
make sure you encrypt passwords, to do this you can use the
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
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.
A simple way to create a database and a user is as follows:
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.
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.
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.
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:
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.
Oh, that reminds me, what port does SQL typically communicate through?
3306 i think
|All times are GMT -5. The time now is 02:56 AM.|