Web Hosting Talk







View Full Version : Sudden MySQL problems


dutchie
11-19-2002, 02:06 PM
I have installed Phpmyadmin 2.2.4 on a Raq550 with MySQL 3.23.38.
When i get a new user requesting a database i create it with a little utility thats sets up the database and mails the user.

All worked fine (and still does on 6 other servers) until yesterday.
Now when i create a new database it assigns the username and password to the database "test" that i did'nt create, no new database is being made.

So i deleted the "test" database, now when i try to create a new database, the new user can login and see all databases of all users, still there's no new database being made.

I configured phpmyadmin with the "http" option, and it worked fine.

There's also a database named "mysql" that i did not made...

Does anybody knows whats happening?

All suggestions more then welcome!

Thanks in advance.

sasha
11-19-2002, 02:15 PM
test database is just that, test database. I think all local users have access to it with no password.

mysql db is created by mysql itself. It holds users info and other databe info there.
Take a look at it. Check out user table. IT should be more or less selfexplanatoy (i doubt I spelled that right). is there a value in the password field by the root account.

Take a look at mysql manual. http://www.mysql.com/doc/en/Adding_users.htmls

dutchie
11-19-2002, 02:27 PM
aaarrggh!

:bawling:
i deleted the "mysql"database !!
now what??

sasha
11-19-2002, 02:51 PM
restore from backup

or

You user databases should still be fine.

There is script that comes with mysql that rebuilds mysql database. mysql_install_db

dutchie
11-19-2002, 03:04 PM
Unfortunatly my users cannot connect and are breathing down my neck..:-(

i did :
---------------
mysql_install_db
---------------

with this result
-----------------------
Preparing db table
Preparing host table
Preparing user table
Preparing func table
Preparing tables_priv table
Preparing columns_priv table
Installing all prepared tables
021119 20:01:24 /usr/sbin/mysqld: Shutdown Complete


To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
This is done with:
/usr/bin/mysqladmin -u root -p password 'new-password'
/usr/bin/mysqladmin -u root -h admin7.123xs.com -p password 'new-password'
See the manual for more instructions.

You can start the MySQL daemon with:
cd / ; /usr/bin/safe_mysqld &

You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; run-all-tests

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com
----------------------------------

I then try to set my password:

------------
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
-----------

so i do:

------------------------
[root mysql]# cd / ; /usr/bin/safe_mysqld &
[1] 5843
[root /]# Starting mysqld daemon with databases from /var/lib/mysql
021119 20:02:19 mysqld ended
-------------------------

still down....

I do not have a backup so it would be great if i could save the databases and get it running again.

dutchie
11-19-2002, 03:13 PM
perhaps i should mention i deleted the server.name.pid file as well.
(i have no idea what i was thinking deleting all that stuff).

sasha
11-19-2002, 03:35 PM
Haha deleting spree. File is irelevant.

Anyway look for the log file in /var/lib/mysql.
Explanation might be there.

dutchie
11-19-2002, 03:45 PM
The .err files said first:

-----------------------------------
021119 20:05:39 mysqld started
021119 20:05:39 Can't start server: Bind on TCP/IP port: Address already in use
021119 20:05:39 Do you already have another mysqld server running on port: 3306 ?
021119 20:05:39 Aborting
-------------------------------------

Then i fumbled a bit ( i know i shouldn't do that but it must be back up!) and got:

----------------------------------

21119 20:05:39 /usr/sbin/mysqld: Shutdown Complete

021119 20:05:39 mysqld ended

021119 20:10:56 mysqld ended

-----------------------------------

Wich looks promising to me, but he, what do i know....
now restarting /etc/rc.d/init.d/mysql start
results in:


------------------------------------
021119 20:42:37 mysqld started
021119 20:42:37 /usr/sbin/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
021119 20:42:37 mysqld ended
--------------------------------------

so i do:
locate host.frm
and get:

--------
/var/lib/mysql/mysql/host.frm
---------

(/mysql/mysql/ ?)

Any more suggestions?


btw thanks for giving me a hand here!

sasha
11-19-2002, 04:11 PM
(/mysql/mysql/ ?)

that is cool , each database has its foldes in /var/lib, so does the mysql

locate host.frm
locate database is not updated all the time so locate is not always accurate.

can you tell me what
ls -l /var/lib/mysql
gives you

dutchie
11-19-2002, 04:14 PM
[removed filelisting]

sasha
11-19-2002, 04:23 PM
ls -l /var/lib/mysql/mysql

dutchie
11-19-2002, 04:25 PM
[removed filelisting]

sasha
11-19-2002, 04:28 PM
ok this could be the problem
chown -R mysql:mysql /var/lib/mysql/mysql

and then try server agin

dutchie
11-19-2002, 04:39 PM
That did it !!!

You're great. come on over i'll kiss you :-)

One last question, my customers db's still won't work (passwords denied), how do i set their password quick from te prompt?

Thanks !

sasha
11-19-2002, 04:48 PM
GRANT ALL PRIVILEGES ON DAtabaseName.* TO username@localhost IDENTIFIED BY 'userPassword' WITH GRANT OPTION

That crates mysql user and gives it password

This and much more you can find in manual.
http://www.mysql.com/doc/en/Adding_users.html

dutchie
11-19-2002, 04:51 PM
Thanks :-)

sasha
11-19-2002, 04:53 PM
You are welcome

dutchie
11-19-2002, 05:04 PM
It seems i got my initial problem back.
It won't create new databases, but new generated users find themselfes in "test".

Any ideas on that?

sasha
11-19-2002, 06:05 PM
remove test database
you users need to specify to which db are they connecting, if you remove test i think that default is database same as thir user name

Oh and yes, you should go back and delete posts with file listing

dutchie
11-20-2002, 04:16 AM
Sasha you helped me bigtime, many many thanks!