LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   mysql just wont work (https://www.linuxquestions.org/questions/linux-software-2/mysql-just-wont-work-71003/)

nocturnal 07-08-2003 12:15 PM

mysql just wont work
 
i've had this problem for 4 days now so please someone just point me in the right direction :(

i followed the instructions in a post here to get mysql working on slack 9 and i'm now using phpmyadmin to set user to root with all privs and no password and on localhost, and then there is this cms i'm trying to setup and it works just fine cuz i've used it before but this is the first time i'm doing it on my own box so i set it's config file to connect to localhost with root and no password and of course to the db name and before all this i've added the db intp phpmyadmin with success and now i flush user privs and i restart mysqld and it still wont work it simply shows nothing on the page that should be from the db it just shows the html and php code but not the db entries like news and it wont let me login(i'm using my old db from the last server) just like it doesn't even know that the db is there

could anyone please help me?

MasterC 07-08-2003 12:21 PM

From the sounds of your description:
Quote:

[snip]...shows nothing on the page that should be from the db it just shows the html and php code but not the db entries like news...[snip]
You either don't have Apache configured to use PHP, or you don't have PHP working correctly.

You might look at the respective sights, starting with www.php.net to make sure you've got those things setup correctly first.

Cool

nocturnal 07-08-2003 02:07 PM

the entire site is in php using echo to output html code it's the info that is in the db and which is also supposed to be output at certain places that is not being output, i know php works i ran tests.

MasterC 07-08-2003 07:29 PM

If you are seeing a screen that just looks like code (like if you choose to View Source on this page) then it's most likely something either:
1. Wrong with the PHP code itself;
2. Wrong with Apace interfacing with PHP;
3. Wrong with PHP's setup.

The DB part of the equation shouldn't even come into play yet, unless you aren't seeing code and I just read your initial inquiry wrong?

:)

Cool

nocturnal 07-08-2003 08:03 PM

no no the php works fine...
the entire site is coded in php and it look just the way it's supposed to look but in those places that i know it's supposed to show data from the db thats where it shows nothing and i get no mysql errors

MasterC 07-09-2003 01:58 AM

Sounds good then, so let's tackle this MySQL thing then, which version are we going to be doing this on?

When you login to MySQL as root:
#mysql -u root -p
ROOTPASS
Where ROOTPASS is the mysql root user's password (not necessarily the same one from your system)
And display the databses:
mysql>show databases;
Does it list the database you created? If not, then there was a problem somewhere along those lines. Try retracing those steps to figure out where.

If it does list the database, did you give permissions to the user who will be grabbing info from it?

Cool

nocturnal 07-09-2003 05:34 AM

mysql> show databases;
+----------+
| Database |
+----------+
| fundb |
| mysql |
| test |
+----------+
3 rows in set (0.00 sec)

mysql>


the two db's that are there from install are there and fundb is the one i've created...
how do i create proper permissions for it?
just for future refference:
it's 3.23.56
slackware 9
the php works
i did mysql -u root -p and typed in a password and that sent me into mysql and let me do show databases;

thanks a lot for your help

MasterC 07-09-2003 06:56 AM

If it's possible, if you aren't using MySQL for anything else yet, I'd suggest upgrading to the latest 4.0.13 release; however there isn't really a problem with 'not' doing that, so no worries should you choose not to ;)

On we go, permissions for users in mysql:

To create a user and to give them privileges in one full swoop (very nice feature I might add) you can use the GRANT option:
GRANT ALL PRIVILEGES ON fundb.* TO nocturnal@localhost IDENTIFIED BY 'a_password' WITH GRANT OPTION;

Be sure to follow each set of commands with a ; this tells mysql you are done and to then execute your request(s). To find out options to give to a user other than "ALL PRIVILEGES" see this page:
http://www.mysql.com/doc/en/GRANT.html

What the above syntax will do is create a user named "nocturnal" and give them access to any files in fundb, and it will create them with the password a_password The ' ' around 'a_password' should actually be included in the syntax.

At that point, if you give ALL PRIVILEGES to user nocturnal, then this user (with password since you also say identified by password) will have full access to that database and you can pass this information onto your application.

You should, for security, change that to only the necessary privileges necessary for your purposes, and you should also make sure that your user is extremely unprivileged with other databases should this one get comprimised. But for basic troubleshooting purposes, a user, will full privileges will be fine.

:)

Cool

nocturnal 07-09-2003 09:26 AM

i did what you said and changed my site details and since i saw in the process list in phpmyadmin that fundb was not running i even did use fundb; in mysql so that it was in use but it still wont work...

thanks a lot for your help anyways

MasterC 07-09-2003 09:33 AM

Does fundb contain tables, or is it just an empty db shell? You will need to create tables in there usually as well, otherwise your applications have no idea on where to store things. Some (such as Postnuke) will make their own tables, so that's fine, but if your software doesn't then you will need to yourself. Read the softwares documentation to see if there is any mention of this.

:)

Cool

nocturnal 07-09-2003 11:08 AM

there are tables i can see them through going to the db dir or through phpmyadmin since the db is simply a db i used on another server with the same cms and on this other server everything worked but i didn't set it up there and i just moved the whole thing to my box...

thanks a lot for your help but i wont waste your time anymore seems like i always get these weird problems that no one has answers to :(

thanks a lot for trying still :)

MasterC 07-09-2003 07:44 PM

You aren't wasting my time, that's what we are here for, to help suss out problems ;)

Cool

Manuel-H 07-10-2003 01:26 AM

Check list
 
Just a checklist..

Make sure you have this php installed
/etc/apache/httpd.conf
Include /etc/apache/mod_php.conf

Make sure you run this program to create all the db
/usr/bin
mysql_install_db

chaneg the permission
/var/lib/mysql
chown -R mysql:mysql mysql

Test the apache
lynx localhost
or in windows via IE or Netscape
http://your local ip/

Test the PHP
have a test file called say test.php
inside this file put in
<? phpinfo(); ?>

Let me know which area do you have problem with.

nocturnal 07-10-2003 08:02 AM

apache -- CHECK! ;)
php -- CHECK!
and i've also done all that with the mysql but i was wondering, does it affect things at all if i'm root or user when i'm doing all these things with mysql cuz some things like chown -R mysql:mysql mysql can't even be done without being root?
the thought hit me when i was doing locate after the db i wanna use with my user and it didn't find it and then i did locate with root and it found it of course so maybe thats it?


All times are GMT -5. The time now is 12:29 AM.