3

BACKGROUND:

I installed Percona Server on a fresh Centos 6.4 minimal. Prior to this, I have never installed MySQL (though I'm not sure if Centos 6.4 minimal came with MySQL?)

Anyway, here are the commands I used:

rpm -Uhv http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpm
yum install Percona-Server-client-55 Percona-Server-server-55

Everything seems installed properly. However, I'm confused...

1) How come, unlike MySQL, did it not prompt me for creation of root password? How do I set the root password then?

2) When I tried starting Percona MySQL with the command "/etc/init.d/mysql start", it gave me the error:

Starting MySQL (Percona Server). ERROR! The server quit without updating PID file (/var/lib/mysql/mail.example.com.pid)

Of course, here I used example.com in place of my real domain name.

Another thing: the "pid" file does not exist. Should it be there?

Any help would be greatly appreciated.

Thanks!

EDIT:

As per the advice I got, I did a "ls -l /var/lib" and this is the folder permission of "/var/lib/mysql"

drwxr-xr-x. 4 mysql   mysql 4096 Apr 26 07:01 mysql

Not sure if this is the correct permission?

Honey Badger
  • 829
  • 3
  • 11
  • 15
  • When you see an error like that, the first thing to do is look at the log file, you may be missing a file, or have wrong permissions on a directory, etc. – NickW Apr 26 '13 at 11:03
  • `grep mysql /var/log/audit/audit.log | grep denied` anything returned? could be selinux related, and no don't just turn it off, let's see if we can fix first :) – Oneiroi Apr 26 '13 at 11:37
  • @Oneiroi, thanks for your help. No the grep did not return anything. – Honey Badger Apr 26 '13 at 11:52

3 Answers3

3
  mysql_install_db
  chown -R mysql:mysql /yourdatadir
  service mysql start

This should do the job for you.

  • Thanks @Abhishek Amralkar. In my case, is "/yourdatadir" = /var/lib/mysql ? Percona Server seems to have a default data directory of "/var/lib/mysql/data/", but in my case I don't have the "data" folder in /var/lib/mysql. Thanks for clarifications! – Honey Badger Apr 26 '13 at 12:06
  • In other words, how do I know where my MySQL data directory is? Can I specify another folder? Or is it fixed? Where do I set it? Thanks! – Honey Badger Apr 26 '13 at 12:09
  • By default mysql default data dir is /var/lib/mysql , and if any have changed data directory path then look in my.cnf file /etc/my.cnf for datadir paramater. – Abhishek Anand Amralkar Apr 26 '13 at 12:20
  • It worked, thank you! Btw, I did "mysql_install_db" but not "chown -R mysql:mysql /yourdatadir" since the permission structure for the "/var/lib/mysql" is already correct (I think? See Edit above. Could you kindly verify?) – Honey Badger Apr 26 '13 at 12:44
  • Yes that looks good. – Abhishek Anand Amralkar Apr 26 '13 at 12:46
0

How do I set the root password then?

It's not uncommon for MySQL installations to ship like this - once you've got the server started, start mysql as root then change the passwd:

[root@yourbox ~]# mysql
....
mysql> UPDATE mysql.user 
SET Password=PASSWORD('cleartext password')
WHERE User='root';

Query OK, 2 rows affected (0.01 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> FLUSH PRIVILEGES;

As for fixing your error (which you'll need to do before changing the password) - this is usually caused by a permissions problem. Check that the directory /var/lib/mysql/ exists and is writeable by the dbms uid, and that the DBMS uid can write to the data files / directory. If still having a problem, check the mysql log and see if there is a file in the /var/lib/mysql/ directory with a .err extension.

symcbean
  • 21,009
  • 1
  • 31
  • 52
  • Thank you, @symcbean. The directory exists, and I think the permission is ok, though I'm not sure. Please see my "Edit" above. Another thing: There is no file with ".err" extension in /var/lib/mysql – Honey Badger Apr 26 '13 at 11:54
0

Make sure the user running mysql (normally mysql) has permission to read/write/create files in all directories that are referenced in the configuration files.

If you have changed the location of log file to /var/log/mysql, for example, then then that directory should be owned by the mysql user.

joehep
  • 101