aspose file tools*
The moose likes Linux / UNIX and the fly likes Installing mysql on Linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Installing mysql on Linux" Watch "Installing mysql on Linux" New topic
Author

Installing mysql on Linux

shivani anand
Ranch Hand

Joined: Dec 28, 2000
Posts: 155
Hi! All

I've installed folowing mysql components on linux redhat

rpm -qa | grep -i sql
MySQL-client-4.1.8-0
MySQL-server-4.1.8-0
MySQL-devel-4.1.8-0
MySQL-shared-4.1.8-0

I tried to start mysql /etc/rc.d/init.d/mysql start
Process dosen't starts
also used

$/usr/bin/mysqld_safe &
[1] 6436
$Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/run/mysqld/mysqld.pid
050113 19:46:16 mysqld ended


[1]+ Done sudo /usr/bin/mysqld_safe

I am getting following error when I am trying to run mysqladmin
$sudo /usr/bin/mysqladmin -u root password newdb
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' (111)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!

$mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

I checked mysql.sock is not created.


Please suggest what's going wrong it's urgent.

Thanks
SA
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16137
    
  21

Well, your packages are OK, it seems (you could double-check with rpm -V). It's possible that you either need firewall (iptables) rules to contact the MYSQL port or need to configure MYSQL to use sockets. I think MYSQL comes setup for sockets, but I'm not sure - PostgreSQL doesn't (on redhat).

I recommend starting the server like so:

/sbin/service mysql start

It may show the status a little better. Also look for errors in /var/log/messages.


Customer surveys are for companies who didn't pay proper attention to begin with.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18896
    
  40

I had a similar problem when I installed mysql on redhat. It turned out that I had an older version of mysql installed, and it was conflicting.

Take a look to see it there is an /etc/my.cnf file, and if there is, make sure it is referring to your newly installed mysql database.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
shivani anand
Ranch Hand

Joined: Dec 28, 2000
Posts: 155
I tried to start mysqld through /sbin/service mysql start and following are content of /var/log/mysqld.log

050118 16:19:06 mysqld started
050118 16:19:06 mysqld ended

050118 16:27:29 mysqld started
050118 16:27:29 mysqld ended

It starts and then stops .

Contrent of my.cnf is .............
$cat my.cnf
[mysql_server]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

[mysql.server]
user=mysql
basedir=/var/lib
set-variable = max_connections=1000

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Any clue what's happening??



SA
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Did you look in /var/log/mysqld.log ?


[Jess in Action][AskingGoodQuestions]
shivani anand
Ranch Hand

Joined: Dec 28, 2000
Posts: 155
yes in my previous mail I sent content of /var/lib/mysqld.log
050118 16:19:06 mysqld started
050118 16:19:06 mysqld ended

050118 16:27:29 mysqld started
050118 16:27:29 mysqld ended
SA
shivani anand
Ranch Hand

Joined: Dec 28, 2000
Posts: 155
Is there a way to enable verbose logging with mysql?
SA
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
I am running redhat9 with mysql and I believe you must be root in order to start mysql. Try logging in as root(su) and then start mysql




Also you can use the --verbose switch when using mysqld.

Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
You can login as root by typing "su" at the command prompt, you will then be prompted with a password prompt.

>su <nl>
>password:

You can exit from root by typing "exit" at the command prompt.

I hope this helps.
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
One more thing, you can verify if mysql is running by typing the following at the command prompt:

Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923



The 'grep mysql' command often finds itself, which is annoying in automated scripts.


http://home.arcor.de/hirnstrom/bewerbung
shivani anand
Ranch Hand

Joined: Dec 28, 2000
Posts: 155
Tim,

As suggested by you what needs to be done regarding following...
It's possible that you either need firewall (iptables) rules to contact the MYSQL port or need to configure MYSQL to use sockets

plesae ellaborate.

thanks
SA
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18896
    
  40

Originally posted by shivani anand:
As suggested by you what needs to be done regarding following...
It's possible that you either need firewall (iptables) rules to contact the MYSQL port or need to configure MYSQL to use sockets


Not sure how you configured MySQL, but the last time I played with it, it is configured to used both sock files, and network connections. By default, it will use the sock file if it is the localhost, and it will use the port otherwise. There is also a switch to override it.

BTW, you should use a local connection first, as you need to connect to grant the privileges for the remote connection.

Henry
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Installing mysql on Linux