Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Some help with MySQL?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
xenon
Guru
Guru


Joined: 25 Dec 2002
Posts: 432
Location: Europe

PostPosted: Fri Feb 07, 2003 9:43 pm    Post subject: Some help with MySQL? Reply with quote

I had a nice MySql database up and running in Windows... it hadn't been that hard to setup. Now, I'm trying to use it in Gentoo, and it's a hell. There's a confusing mix of users of the operating system, users of the database, users of phpmyadmin... I'd just need a quick and dirty start guide... anyone?

Thanks, really.
Back to top
View user's profile Send private message
darktux
Veteran
Veteran


Joined: 16 Nov 2002
Posts: 1086
Location: Coimbra, Portugal

PostPosted: Fri Feb 07, 2003 9:51 pm    Post subject: Reply with quote

Users from the operating system are different from the ones able to access MySQL, and the ONE mentioned on the phpmyadmin conf files, is an already existing user able to use MySQL. There's no mix _AT ALL_.

You can read some docs @ www.mysql.com
_________________
Lego my ego, and I'll lego your knowledge

www.tuxslare.org - My reborn website :P
Back to top
View user's profile Send private message
xenon
Guru
Guru


Joined: 25 Dec 2002
Posts: 432
Location: Europe

PostPosted: Sat Feb 08, 2003 3:55 am    Post subject: Reply with quote

Ok, I'll try to sort things out. I know there's a lot of docs at mysql.com, but they're mainly about building and maintaining a DB, not installing one...
Back to top
View user's profile Send private message
darktux
Veteran
Veteran


Joined: 16 Nov 2002
Posts: 1086
Location: Coimbra, Portugal

PostPosted: Sat Feb 08, 2003 4:40 am    Post subject: Reply with quote

xenon wrote:
Ok, I'll try to sort things out. I know there's a lot of docs at mysql.com, but they're mainly about building and maintaining a DB, not installing one...


Ask away, and we'll try to help :wink:
_________________
Lego my ego, and I'll lego your knowledge

www.tuxslare.org - My reborn website :P
Back to top
View user's profile Send private message
xenon
Guru
Guru


Joined: 25 Dec 2002
Posts: 432
Location: Europe

PostPosted: Sat Feb 08, 2003 7:03 pm    Post subject: Reply with quote

I'm still stuck, and in a bad way. I'm starting to understand this users thing, but I'm still pretty confused. If I use the command line thing, all is almost fine, but running a php page to access the database, I can only see the 'test' db. Oh, and then: the users listed in phpmyadmin are his own users, or MySQL users?

Thanks.
Back to top
View user's profile Send private message
darktux
Veteran
Veteran


Joined: 16 Nov 2002
Posts: 1086
Location: Coimbra, Portugal

PostPosted: Sat Feb 08, 2003 7:13 pm    Post subject: Reply with quote

Then use only the command line 'thing' 8)

I personally don't like phpMyAdmin much. The users that you see on phpMyAdmin are the ones that you'd see if you do on the command line:

use mysql
select * from users;

Basiclly.... Give it a go... To see the users that can access MySQL and compare then to the ones it shows on phpMyAdmin. To get a better output do select user,password from users;
_________________
Lego my ego, and I'll lego your knowledge

www.tuxslare.org - My reborn website :P
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Sat Feb 08, 2003 8:05 pm    Post subject: Reply with quote

Use the GRANT command instead of messing directly with adding users. Your quality of life will improve.
_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
xenon
Guru
Guru


Joined: 25 Dec 2002
Posts: 432
Location: Europe

PostPosted: Sat Feb 08, 2003 10:02 pm    Post subject: Reply with quote

Thanks, but... :oops:

In my mysql.user table, there are now only the root user and the default "any" entry with no privileges. Infact, if I use the command line client, user root can properly access the database. All right. Now: I have a php thingie (again! :)) to manage a database of links. Part of it is obviously a connection to the MySQL db (evetyhing worked fine in Windoze).
This is the connection related php code:
Code:
/* Connecting, selecting database */
    $llink = mysql_connect("localhost", "$un", "$pw")
        or die("Could not connect");
    mysql_select_db("links") or die("Could not select database");
As simple as it gets; $un and $pw are (correctly) read from a local text file. But if I put root:mypasswd in the file (the same root:mypasswd that work in mysql command line), in my php page I get
Code:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user: 'root@localhost' (Using password: YES) in /home/httpd/...
If I just put "mysql" in that text file, I can login but can't access any other db than "test". Note that this user "mysql" won't work in command line and is not in my mysql.user table. It is however defined in my.cnf, of course. So there *is* indeed something weird about how users are dealt with, ain't it? Can someone enlighten me? File permissions for the physical db files are spread open, so they're not the problem.

Many thanks.
Back to top
View user's profile Send private message
darktux
Veteran
Veteran


Joined: 16 Nov 2002
Posts: 1086
Location: Coimbra, Portugal

PostPosted: Sun Feb 09, 2003 1:06 am    Post subject: Reply with quote

Have you defined your mysql's root password?
_________________
Lego my ego, and I'll lego your knowledge

www.tuxslare.org - My reborn website :P
Back to top
View user's profile Send private message
xenon
Guru
Guru


Joined: 25 Dec 2002
Posts: 432
Location: Europe

PostPosted: Sun Feb 09, 2003 2:42 am    Post subject: Reply with quote

Sure, that's the first thing I did. What I need is to understand how the users in mysql.user relate with the "mysql" user defined in my.conf and the users of the OS.
A short step by step guide to start from scratch would also be very welcome - I just need to know all the conf files to delete (the db itself has a backup, it'd be no problem to wipe it out).
Thanks a lot for your help.
Back to top
View user's profile Send private message
darktux
Veteran
Veteran


Joined: 16 Nov 2002
Posts: 1086
Location: Coimbra, Portugal

PostPosted: Sun Feb 09, 2003 3:01 am    Post subject: Reply with quote

xenon wrote:
Sure, that's the first thing I did. What I need is to understand how the users in mysql.user relate with the "mysql" user defined in my.conf and the users of the OS.
A short step by step guide to start from scratch would also be very welcome - I just need to know all the conf files to delete (the db itself has a backup, it'd be no problem to wipe it out).
Thanks a lot for your help.


I've already told you that the OS users don't relate AT ALL with MySQL. You really oughta read the documentation @ mysql.com, because it would solve all your problems... It is really good and offers examples..
_________________
Lego my ego, and I'll lego your knowledge

www.tuxslare.org - My reborn website :P
Back to top
View user's profile Send private message
xenon
Guru
Guru


Joined: 25 Dec 2002
Posts: 432
Location: Europe

PostPosted: Sun Feb 09, 2003 3:10 pm    Post subject: Reply with quote

Firstof all, I really don't want to question your knowledge and I appreciate your help. I'm gonna read the docs again, maybe I missed something. Would you just tell me what's the "role" of the users defined in my.cnf? Thanks.
Back to top
View user's profile Send private message
darktux
Veteran
Veteran


Joined: 16 Nov 2002
Posts: 1086
Location: Coimbra, Portugal

PostPosted: Sun Feb 09, 2003 4:24 pm    Post subject: Reply with quote

xenon wrote:
Firstof all, I really don't want to question your knowledge and I appreciate your help. I'm gonna read the docs again, maybe I missed something. Would you just tell me what's the "role" of the users defined in my.cnf? Thanks.


Quote:


A.3.2 How to Run MySQL As a Normal User

The MySQL server mysqld can be started and run by any user. In order to change mysqld to run as a Unix user user_name, you must do the following:

1. Stop the server if it's running (use mysqladmin shutdown).
2. Change the database directories and files so that user_name has privileges to read and write files in them (you may need to do this as the Unix root user):

shell> chown -R user_name /path/to/mysql/datadir

If directories or files within the MySQL data directory are symlinks, you'll also need to follow those links and change the directories and files they point to. chown -R may not follow symlinks for you.
3. Start the server as user user_name, or, if you are using MySQL Version 3.22 or later, start mysqld as the Unix root user and use the --user=user_name option. mysqld will switch to run as the Unix user user_name before accepting any connections.
4. To start the server as the given user name automatically at system startup time, add a user line that specifies the user name to the [mysqld] group of the `/etc/my.cnf' option file or the `my.cnf' option file in the server's data directory. For example:

[mysqld]
user=user_name


Taken from mysql's website..

Quote:

MySQL Manual

o 1 General Information
o 2 MySQL Installation
o 3 Tutorial Introduction <---- THERE'S YOUR TUTORIAL
o 4 Database Administration
o 5 MySQL Optimisation
o 6 MySQL Language Reference
o 7 MySQL Table Types
o 8 MySQL APIs
o 9 Extending MySQL
o A Problems and Common Errors
o B Contributed Programs
o C Credits
o D MySQL Change History
o E Porting to Other Systems
o F Environment Variables
o G MySQL Regular Expressions
o H GNU General Public License
o I GNU Lesser General Public License
o SQL command, type and function index
o Concept Index

_________________
Lego my ego, and I'll lego your knowledge

www.tuxslare.org - My reborn website :P
Back to top
View user's profile Send private message
xenon
Guru
Guru


Joined: 25 Dec 2002
Posts: 432
Location: Europe

PostPosted: Sun Feb 09, 2003 8:26 pm    Post subject: Reply with quote

Ok, some things are still obscure, but at least I'm able to use my db.
Back to top
View user's profile Send private message
darktux
Veteran
Veteran


Joined: 16 Nov 2002
Posts: 1086
Location: Coimbra, Portugal

PostPosted: Sun Feb 09, 2003 8:56 pm    Post subject: Reply with quote

Read the Tutorial and then if you don't understand something, then ask. :wink:
_________________
Lego my ego, and I'll lego your knowledge

www.tuxslare.org - My reborn website :P
Back to top
View user's profile Send private message
xenon
Guru
Guru


Joined: 25 Dec 2002
Posts: 432
Location: Europe

PostPosted: Mon Feb 10, 2003 12:14 am    Post subject: Reply with quote

Ok.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum