• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Installing mysql on Linux

 
shivani anand
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Henry Wong
author
Marshal
Pie
Posts: 21414
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
shivani anand
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you look in /var/log/mysqld.log ?
 
shivani anand
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to enable verbose logging with mysql?
SA
 
Craig Jackson
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 405
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 405
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One more thing, you can verify if mysql is running by typing the following at the command prompt:

 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


The 'grep mysql' command often finds itself, which is annoying in automated scripts.
 
shivani anand
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 21414
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic