Install MySQL 5.5.31 on Fedora 18/17, CentOS/Red Hat (RHEL) 6.4/5.9

MySQL is a relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases. This is guide, howto install or upgrade MySQL Community Server latest and greatest version 5.5.31 on Fedora 18/17/16/15/14/13/12, CentOS 6.4/6.3/6.2/6.1/6/5.9 and Red Hat (RHEL) 6.4/6.3/6.2/6.1/6/5.9.

Note: If you are upgrading MySQL (from earlier version), then make sure that you backup (dump and copy) your database and configs. And remember run mysql_upgrade command.

Install MySQL Database 5.5.31 on Fedora 18/17/16/15/14/13/12, CentOS 6.4/5.9, Red Hat (RHEL) 6.4/5.9

1. Change root user

su -
## OR ##
sudo -i

2. Install Remi repository

Fedora

## Remi Dependency on Fedora 18, 17, 16
rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm 
rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm
 
## Fedora 18 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-18.rpm
 
## Fedora 17 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-17.rpm
 
## Fedora 16 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-16.rpm
 
## Fedora 15 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-15.rpm
 
## Fedora 14 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-14.rpm
 
## Fedora 13 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-13.rpm
 
## Fedora 12 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-12.rpm

CentOS and Red Hat (RHEL)

## Remi Dependency on CentOS 6 and Red Hat (RHEL) 6 ##
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
 
## CentOS 6 and Red Hat (RHEL) 6 ##
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
 
 
## Remi Dependency on CentOS 5 and Red Hat (RHEL) 5 ##
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
 
## CentOS 5 and Red Hat (RHEL) 5 ## 
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

3. Check Available MySQL versions

Fedora 18, 17, 16, 15, 14, 13, 12

yum --enablerepo=remi list mysql mysql-server

CentOS 6.4/6.3/6.2/6.1/6/5.9 and Red Hat (RHEL) 6.4/6.3/6.2/6.1/6/5.9

yum --enablerepo=remi,remi-test list mysql mysql-server

Output:

Loaded plugins: changelog, fastestmirror, presto, refresh-packagekit
...
remi                                                            | 3.0 kB     00:00     
remi/primary_db                                                 | 106 kB     00:00     
Available Packages
mysql.i686                               5.5.31-1.fc14.remi                        @remi
mysql-server.i686                        5.5.31-1.fc14.remi                        @remi

4. Update or Install MySQL 5.5.31

Fedora 18, 17, 16, 15, 14, 13, 12

yum --enablerepo=remi install mysql mysql-server

CentOS 6.4/6.3/6.2/6.1/6/5.9 and Red Hat (RHEL) 6.4/6.3/6.2/6.1/6/5.9

yum --enablerepo=remi,remi-test install mysql mysql-server

5. Start MySQL server and autostart MySQL on boot

Fedora 18/17/16

systemctl start mysqld.service ## use restart after update
 
systemctl enable mysqld.service

Fedora 15/14/13/12/11, CentOS 6.4/6.3/6.2/6.1/6/5.9 and Red Hat (RHEL) 6.4/6.3/6.2/6.1/6/5.9

/etc/init.d/mysqld start ## use restart after update
## OR ##
service mysqld start ## use restart after update
 
chkconfig --levels 235 mysqld on

6. MySQL Secure Installation

  • Set (Change) root password
  • Remove anonymous users
  • Disallow root login remotely
  • Remove test database and access to it
  • Reload privilege tables

Start MySQL Secure Installation with following command

/usr/bin/mysql_secure_installation

Output:

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
 
 
In order to log into MySQL to secure it, we\'ll need the current
password for the root user.  If you\'ve just installed MySQL, and
you haven\'t set the root password yet, the password will be blank,
so you should just press enter here.
 
Enter current password for root (enter for none): 
OK, successfully used password, moving on...
 
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
 
Set root password? [Y/n] Y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!
 
 
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
 
Remove anonymous users? [Y/n] Y
 ... Success!
 
Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.
 
Disallow root login remotely? [Y/n] Y
 ... Success!
 
By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
 
Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
 
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
 
Reload privilege tables now? [Y/n] Y
 ... Success!
 
Cleaning up...
 
 
 
All done!  If you\'ve completed all of the above steps, your MySQL
installation should now be secure.
 
Thanks for using MySQL!

Note: If you don’t want some reason, do a “MySQL Secure Installation” then at least it’s very important to change the root user’s password

mysqladmin -u root password [your_password_here]
 
## Example ##
mysqladmin -u root password myownsecrectpass

7. Connect to MySQL database (localhost) with password

mysql -u root -p
 
## OR ##
mysql -h localhost -u root -p

8. Create Database, Create MySQL User and Enable Remote Connections to MySQL Database

This example uses following parameters:

  • DB_NAME = webdb
  • USER_NAME = webdb_user
  • REMOTE_IP = 10.0.15.25
  • PASSWORD = password123
  • PERMISSIONS = ALL
## CREATE DATABASE ##
mysql> CREATE DATABASE webdb;
 
## CREATE USER ##
mysql> CREATE USER 'webdb_user'@'10.0.15.25' IDENTIFIED BY 'password123';
 
## GRANT PERMISSIONS ##
mysql> GRANT ALL ON webdb.* TO 'webdb_user'@'10.0.15.25';
 
##  FLUSH PRIVILEGES, Tell the server TO reload the GRANT TABLES  ##
mysql> FLUSH PRIVILEGES;

Enable Remote Connection to MySQL Server –> Open MySQL Port (3306) on Iptables Firewall (as root user again)

1. Edit /etc/sysconfig/iptables file:

nano -w /etc/sysconfig/iptables

2. Add following INPUT rule:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

3. Restart Iptables Firewall:

service iptables restart
## OR ##
/etc/init.d/iptables restart

4. Test remote connection:

mysql -h dbserver_name_or_ip_address -u webdb_user -p webdb
Follow If Not True Then False Updates!

220 Comments

  1. Great tutorial (like all the others on your site).

    Thanks Davide

    • the info contained on this page was really helpful. great work

  2. Thank you, JR

    Httpd start normally.

    audit.log -> http://www.sendspace.com/file/vlq3wk

    [root@rrom-notebook rrom]# grep mysql /var/log/audit/audit.log > audit.log
    [root@rrom-notebook rrom]#
    [root@rrom-notebook rrom]# wc -l /var/log/audit/audit.log
    19300 /var/log/audit/audit.log
    [root@rrom-notebook rrom]# ^C
    [root@rrom-notebook rrom]#

    • Hi Roman,

      Still sounds some SELinux problem, but I’m not sure is your auditd service running, please could you post also output of following command:

      systemctl status auditd.service

      Do you run MySQL just with default setup?

      • I just noticed that the selinux-policy-3.10.0-61 and selinux-policy-targeted-3.10.0-61 is released, so try update your system and try to start mysql service again…?

  3. [rrom@rrom-notebook ~]$ systemctl status auditd.service
    auditd.service – Security Auditing Service
    Loaded: loaded (/lib/systemd/system/auditd.service; enabled)
    Active: active (running) since Thu, 01 Dec 2011 10:56:07 +0300; 19min ago
    Process: 1065 ExecStartPost=/sbin/auditctl -R /etc/audit/audit.rules (code=exited, status=0/SUCCESS)
    Main PID: 1059 (auditd)
    CGroup: name=systemd:/system/auditd.service
    ├ 1059 /sbin/auditd -n
    ├ 1098 /sbin/audispd
    └ 1099 /usr/sbin/sedispatch
    [rrom@rrom-notebook ~]$

    I update system to selinux-policy-3.10.0-61 and selinux-policy-targeted-3.10.0-61, but:

    [rrom@rrom-notebook ~]$ sudo service mysqld start
    [sudo] password for rrom:
    Redirecting to /bin/systemctl start mysqld.service
    Job failed. See system logs and ‘systemctl status’ for details.
    [rrom@rrom-notebook ~]$

  4. [rrom@rrom-notebook ~]$ su
    Password:
    [root@rrom-notebook rrom]# grep mysqld_safe /var/log/audit/audit.log | audit2allow -M mysqlpol
    compilation failed:
    mysqlpol.te:6:ERROR ‘syntax error’ at token ” on line 6:

    /usr/bin/checkmodule: error(s) encountered while parsing configuration
    /usr/bin/checkmodule: loading policy configuration from mysqlpol.te
    [root@rrom-notebook rrom]# semodule -i mysqlpol.pp
    semodule: Failed on mysqlpol.pp!
    [root@rrom-notebook rrom]#

  5. Hi Roman,

    Okey, I have to believe that it’s not SELinux problem. :) And yes audit2allow fails because your grep command grep mysqld_safe /var/log/audit/audit.log output is just empty.

    So this is some totally new problem. I actually do some tests with just installed Fedora 16 and installed mysql and mysql-server packages and it’s starts normally, so this is very strange, but next I have to ask more information from you… :) Let’s check following things next, could you post following log file here (So I assume that you are using the default mysqld log file):

    /var/log/mysqld.log

    And then try following:

    ## Change root ##
    su -
     
    ## Change mysql user ##
    su mysql
     
    ## Run following long command ##
    ## 32-bit system ##
    /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
     
    ## 64-bit system
    /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock

    This is exactly same command what systemctl tries to run. Do you get any errors here or is it failing?

  6. Hi, I got the error:
    ‘Job failed. See system logs and ‘systemctl status’ for details.’

    After execute the command: ‘systemctl start mysqld.service’

    And then I executed: ‘grep mysqld_safe /var/log/audit/audit.log | audit2allow -M mysqlpol’

    But got the error:

    compilation failed:
    mysqlpol.te:6:ERROR ‘syntax error’ at token ” on line 6:

    /usr/bin/checkmodule: error(s) encountered while parsing configuration
    /usr/bin/checkmodule: loading policy configuration from mysqlpol.te

    I Search a lot on net, but don’t found anything! Could you help me JR?

    p.s.: Sorry for my bad english

  7. So, I Execute these commands:

    su -

    ## Change mysql user ##
    su mysql

    ## Run following long command ##

    ## 64-bit system
    /usr/libexec/mysqld –basedir=/usr –datadir=/var/lib/mysql –plugin-dir=/usr/lib64/mysql/plugin –log-error=/var/log/mysqld.log –pid-file=/var/run/mysqld/mysqld.pid –socket=/var/lib/mysql/mysql.sock

    And get no output…

    • Okey, you don’t get output, but is your MySQL server working then? :)

      Open another console and write:

      mysql
      • I got this:

        ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

        And my version of SELinux-policy is:

        selinux-policy.noarch 3.10.0-64.fc16

        • Hi Artur,

          Could you post your /var/log/mysqld.log log file here?

          • 111205 22:02:12 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
            111205 22:02:12 InnoDB: The InnoDB memory heap is disabled
            111205 22:02:12 InnoDB: Mutexes and rw_locks use GCC atomic builtins
            111205 22:02:12 InnoDB: Compressed tables use zlib 1.2.5
            111205 22:02:12 InnoDB: Using Linux native AIO
            111205 22:02:12 InnoDB: Initializing buffer pool, size = 128.0M
            111205 22:02:12 InnoDB: Completed initialization of buffer pool
            111205 22:02:12 InnoDB: highest supported file format is Barracuda.
            111205 22:02:13  InnoDB: Waiting for the background threads to start
            111205 22:02:14 InnoDB: 1.1.8 started; log sequence number 1595675
            111205 22:02:14 [ERROR] /usr/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
            111205 22:02:14 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
            111205 22:02:15 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
            111205 22:02:15 [Note] Plugin 'FEDERATED' is disabled.
            /usr/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
            111205 22:02:15 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
            111205 22:02:15 InnoDB: The InnoDB memory heap is disabled
            111205 22:02:15 InnoDB: Mutexes and rw_locks use GCC atomic builtins
            111205 22:02:15 InnoDB: Compressed tables use zlib 1.2.5
            111205 22:02:15 InnoDB: Using Linux native AIO
            111205 22:02:15 InnoDB: Initializing buffer pool, size = 128.0M
            111205 22:02:15 InnoDB: Completed initialization of buffer pool
            111205 22:02:15 InnoDB: highest supported file format is Barracuda.
            111205 22:02:15  InnoDB: Waiting for the background threads to start
            111205 22:02:16 InnoDB: 1.1.8 started; log sequence number 1595675
            111205 22:02:16 [ERROR] /usr/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
            111205 22:02:16 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
            111205 22:02:17 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
            111205 22:02:17 [Note] Plugin 'FEDERATED' is disabled.
            /usr/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
            111205 22:02:17 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
            111205 22:02:17 InnoDB: The InnoDB memory heap is disabled
            111205 22:02:17 InnoDB: Mutexes and rw_locks use GCC atomic builtins
            111205 22:02:17 InnoDB: Compressed tables use zlib 1.2.5
            111205 22:02:17 InnoDB: Using Linux native AIO
            111205 22:02:17 InnoDB: Initializing buffer pool, size = 128.0M
            111205 22:02:17 InnoDB: Completed initialization of buffer pool
            111205 22:02:17 InnoDB: highest supported file format is Barracuda.
            111205 22:02:17  InnoDB: Waiting for the background threads to start

            I post only these, because the file is too long but these sets of errors are repeated.

            • Thanks Artur,

              Try to run:

              mysql_upgrade

              And please post output of following commands:

              ls -la /usr/lib/mysql
               
              ls -la /var/lib/mysql/mysql/ |grep -e host -e plugin
              • root@artur artur# mysql_upgrade
                Looking for ‘mysql’ as: mysql
                Looking for ‘mysqlcheck’ as: mysqlcheck
                Running ‘mysqlcheck with default connection arguments
                mysqlcheck: Got error: 2002: Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2) when trying to connect
                FATAL ERROR: Upgrade failed
                root@artur artur# ls -la /usr/lib/mysql
                ls: impossível acessar /usr/lib/mysql: Arquivo ou diretório não encontrado
                root@artur artur# ls -la /var/lib/mysql/mysql/ |grep -e host -e plugin
                -rw-rw—-. 1 root root 9510 Dez 4 20:01 host.frm
                -rw-rw—-. 1 root root 0 Dez 4 20:01 host.MYD
                -rw-rw—-. 1 root root 2048 Dez 4 20:01 host.MYI
                -rw-rw—-. 1 root root 8586 Dez 4 20:01 plugin.frm
                -rw-rw—-. 1 root root 0 Dez 4 20:01 plugin.MYD
                -rw-rw—-. 1 root root 1024 Dez 4 20:01 plugin.MYI

                • Now I see your problem, you have (at least) wrong permissions on /usr/lib/mysql/mysql directory. And sorry I ask you ls output from wrong directory, so could you post also output of following commands:

                  ls -la /var/lib/ |grep mysql
                   
                  ls -la /var/lib/mysql
                  • No problem! You helps me so much…Of course I won’t reclaim hehehe.

                    The Outputs:

                    root@artur artur# ls -la /var/lib/ |grep mysql
                    drwxr-xr-x. 5 mysql mysql 4096 Dez 6 17:00 mysql
                    root@artur artur# ls -la /var/lib/mysql
                    total 28696
                    drwxr-xr-x. 5 mysql mysql 4096 Dez 6 17:00 .
                    drwxr-xr-x. 43 root root 4096 Dez 4 19:41 ..
                    -rw——-. 1 mysql mysql 402 Dez 4 23:11 .bash_history
                    -rw-rw—-. 1 mysql mysql 18874368 Dez 4 21:01 ibdata1
                    -rw-rw—-. 1 mysql mysql 5242880 Dez 6 17:00 ib_logfile0
                    -rw-rw—-. 1 mysql mysql 5242880 Dez 4 20:03 ib_logfile1
                    drwx——. 2 root root 4096 Dez 4 20:01 mysql
                    drwx——. 2 root root 4096 Dez 4 20:01 performance_schema
                    drwx——. 2 root root 4096 Dez 4 20:01 test
                    root@artur artur#

                    • Thanks! :)

                      Some reason your permissions are changed from mysql:mysql to root:root, so try following (as root):

                      ## Change directory to /var/lib/mysql ##
                      cd /var/lib/mysql/
                       
                      ## Change directories permissions recursively ##
                      chown -R mysql:mysql mysql/ performance_schema/ test/
                       
                      ## Try to start mysqld again ##
                      systemctl start mysqld.service
  8. It’s works! You are a linux developer or something like this? :0 Well who you understand the last output? I say, to know exataly the problem?
    And how you came to suspect that the problem was access permission?

    Thanks a lot! I am very young on linux and on fedora much more.

    • Excellent to hear that your MySQL is working… :)

      I’m not Linux developer :) But I have used Linux very long time (about 12 years now), I’m also sysadmin, database admin and developer… :)

      Your last output tells about some strange problem with your /var/lib/mysql/ directory permission, just checked my own installations and look what permissions should be when MySQL working normally (I think that some Fedora 16 MySQL update is messed those permissions, because normally MySQL is working out of the box). Actually your MySQL error log shows something interesting when mysqld try to start it doesn’t found /mysql/host.frm and /mysql/plugin.frm files which should exists, that’s why I wanted to see do have those files and what are those files permissions. ;)

      You are very welcome! And it’s always nice to see new Linux users and if you have some problems which are not related to any guides, feel free to join if !1 0 forums and ask your questions. :)

      • Joined!

        • Cool! :)

      • Hi JR,

        I installed fedora16 with the help of your blog….and now i fixed the issue of mysql service with the help of your comments. The problem i was facing was similar to Arthur problem.

        Thanks for writing installation process..

        • Hi Satyajir,

          Excellent to hear that you got both Fedora and MySQL installed! :)

          You are welcome!

  9. thanks for such a wonderfull help in vein. It helps me lot and now I am running my mysql

  10. When I go to /etc/sysconfig/iptables, there is nothing there. I am using CentOS 6. What can I do to correct this?

  11. I found the error in my ways…lol

    Thanks for the awesome tutorial

  12. Thanks a lot for the comprehensive list :). It was very helpful.

  13. Hi JR,

    just a quick question:

    If I would like to run WordPress only from local host, with no intention to access the data from any other computer, do I still need to follow the part

    Enable Remote Connection to MySQL Server –> Open MySQL Port (3306) on Iptables Firewall (as root user again) ?

    Thanks in advance!

    -Mikko

    • Hi Mikko,

      First of all, really nice to hear that you got MySQL working! :)

      And yes, if you want use only local connections, then do not open MySQL port 3306. :)

      In any case might be better not open MySQL port to the public network. This part of guide is mainly/normally intended for LAN usage, where all (database) servers are behind firewalls, load balancers and so on… :)

  14. Hi JR.

    This site is ridiculously helpful.

    I’m having some problems that appear to be similar to but distinct from those that Roman described. I’m able to get almost done with all of step 5, but then when i try this command

    grep mysqld_safe /var/log/audit/audit.log | audit2allow -M mysqlpol

    i get the following

    -bash: audit2allow: command not found

    any idea what i’m up against here?

    your help is much appreciated.

    Ben

    • Hi Benjamin,

      Thanks! :D

      First, do you get following error when you try to start mysqld?

      Job failed. See system logs and 'systemctl status' for details.
  15. Hi,
    after following your steps i got this error :
    ERROR 2003 (HY000): Can’t connect to MySQL server on ’10.0.15.25′ (110)
    Can u suggest me about this ?

    My PC ENVIRONMENT : FEDORA 13 ,Apache installed ,mysql 5.5.20
    I have doubt this remote_ip .. Please explain about it..

    Thank u ..

    • Hi Rizvan,

      This REMOTE_IP 10.0.15.25, is just a hypothetical example, you have to use of course your own remote ip(s) or localhost or some other address.

  16. Hi JR and nice to meet you! Compliments for your guides.

    I have the same problem of Benjamin. I followed all steps without problems on CentOS 6.2.
    When I typed: “service mysqld start” the output was two OK
    Then I typed: “/etc/init.d/mysqld start” and output OK
    Typed: “chkconfig –levels 235 mysqld on” with no output
    Typed: “grep mysqld_safe /var/log/audit/audit.log | audit2allow -M mysqlpol” and the answer was “-bash: audit2allow: command not found”

    What should I do?

    Many thanks
    Elaidon

    • Hi Elaidon and thanks!

      If you do not get Job failed. See system logs and ‘systemctl status’ for details. error then you shouldn’t run grep mysqld_safe /var/log/audit/audit.log | audit2allow -M mysqlpol command at all! :)

      Maybe I should remove whole troubleshooting part… ;)

  17. Hi JR,
    I followed all the steps but,
    i m also facing a problem like:

    [root@localhost mysql]# systemctl start mysqld.serviceJob
    failed. See system logs and ‘systemctl status’ for details.

    [root@localhost mysql]# grep mysqld_safe /var/log/audit/audit.log | audit2allow -M mysqlpol
    compilation failed:
    mysqlpol.te:6:ERROR ‘syntax error’ at token ” on line 6:

    /usr/bin/checkmodule: error(s) encountered while parsing configuration
    /usr/bin/checkmodule: loading policy configuration from mysqlpol.te

    [root@localhost mysql]# ls -la /var/lib/mysql
    total 28720
    drwxr-xr-x. 5 mysql mysql 4096 Feb 18 15:59 .
    drwxr-xr-x. 41 root root 4096 Feb 18 09:56 ..
    -rw-rw—-. 1 mysql mysql 56 Feb 18 10:19 auto.cnf
    -rw——-. 1 mysql mysql 202 Feb 18 15:37 .bash_history
    -rw-rw—-. 1 mysql mysql 18874368 Feb 18 10:43 ibdata1
    -rw-rw—-. 1 mysql mysql 5242880 Feb 18 15:59 ib_logfile0
    -rw-rw—-. 1 mysql mysql 5242880 Feb 18 09:56 ib_logfile1
    -rw-rw—-. 1 mysql root 4147 Feb 18 10:43 localhost.err
    drwx–x–x. 2 mysql mysql 4096 Feb 18 09:56 mysql
    -rw-r–r–. 1 root root 25 Feb 18 15:51 mysqlpol.te
    drwx——. 2 mysql mysql 4096 Feb 18 09:56 performance_schema
    -rw-r–r–. 1 root root 118 Feb 18 09:56 RPM_UPGRADE_HISTORY
    -rw-r–r–. 1 mysql mysql 118 Feb 18 09:56 RPM_UPGRADE_MARKER-LAST
    drwxr-xr-x. 2 mysql mysql 4096 Feb 18 09:56 test

    can u help me
    Thanks

    • Hi SAM,

      Could you post output of following command:

      systemctl status mysqld.service

      And could you also post your /var/log/messages and /var/log/mysqld.log example to pastebin?

  18. Hi JR,
    Followings are the output according to ur requirements:

    [root@localhost sam]# systemctl status mysqld.service
    mysqld.service – MySQL database server
    Loaded: loaded (/lib/systemd/system/mysqld.service; disabled)
    Active: inactive (dead)
    CGroup: name=systemd:/system/mysqld.service

  19. Output of /var/log/messages : its too long so i send some part from starting

    Feb 19 10:14:02 localhost rsyslogd: [origin software="rsyslogd" swVersion="5.8.5" x-pid="1141" x-info="http://www.rsyslog.com"] rsyslogd was HUPed
    Feb 19 10:47:11 localhost dbus[1114]: [system] Activating service name=’net.reactivated.Fprint’ (using servicehelper)
    Feb 19 10:47:11 localhost dbus-daemon[1114]: dbus[1114]: [system] Activating service name=’net.reactivated.Fprint’ (using servicehelper)
    Feb 19 10:47:11 localhost dbus-daemon[1114]: Launching FprintObject
    Feb 19 10:47:11 localhost dbus[1114]: [system] Successfully activated service ‘net.reactivated.Fprint’
    Feb 19 10:47:11 localhost dbus-daemon[1114]: dbus[1114]: [system] Successfully activated service ‘net.reactivated.Fprint’
    Feb 19 10:47:11 localhost dbus-daemon[1114]: ** Message: D-Bus service launched with name: net.reactivated.Fprint
    Feb 19 10:47:11 localhost dbus-daemon[1114]: ** Message: entering main loop
    Feb 19 10:47:41 localhost dbus-daemon[1114]: ** Message: No devices in use, exit
    Feb 19 11:01:01 localhost systemd-logind[1097]: New session 4 of user root.
    Feb 19 11:01:01 localhost systemd-logind[1097]: Removed session 4.
    Feb 19 11:13:58 localhost mysqld_safe[3504]: 120219 11:13:58 mysqld_safe Logging to ‘/var/log/mysqld.log’.
    Feb 19 11:13:58 localhost mysqld_safe[3504]: 120219 11:13:58 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    Feb 19 11:14:00 localhost systemd[1]: mysqld.service: main process exited, code=exited, status=1
    Feb 19 11:14:00 localhost systemd[1]: mysqld.service: control process exited, code=exited status=1
    Feb 19 11:14:00 localhost systemd[1]: mysqld.service holdoff time over, scheduling restart.
    Feb 19 11:14:00 localhost systemd[1]: Job pending for unit, delaying automatic restart.
    Feb 19 11:14:00 localhost systemd[1]: Unit mysqld.service entered failed state.
    Feb 19 11:14:01 localhost mysqld_safe[3711]: 120219 11:14:01 mysqld_safe Logging to ‘/var/log/mysqld.log’.
    Feb 19 11:14:01 localhost mysqld_safe[3711]: 120219 11:14:01 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    Feb 19 11:14:02 localhost systemd[1]: mysqld.service: main process exited, code=exited, status=1
    Feb 19 11:14:03 localhost systemd[1]: mysqld.service: control process exited, code=exited status=1
    Feb 19 11:14:03 localhost systemd[1]: mysqld.service holdoff time over, scheduling restart.
    Feb 19 11:14:03 localhost systemd[1]: Job pending for unit, delaying automatic restart.
    Feb 19 11:14:03 localhost systemd[1]: Unit mysqld.service entered failed state.
    Feb 19 11:14:03 localhost mysqld_safe[3917]: 120219 11:14:03 mysqld_safe Logging to ‘/var/log/mysqld.log’.
    Feb 19 11:14:03 localhost mysqld_safe[3917]: 120219 11:14:03 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    Feb 19 11:14:04 localhost systemd[1]: mysqld.service: main process exited, code=exited, status=1
    Feb 19 11:14:05 localhost systemd[1]: mysqld.service: control process exited, code=exited status=1
    Feb 19 11:14:05 localhost systemd[1]: mysqld.service holdoff time over, scheduling restart.
    Feb 19 11:14:05 localhost systemd[1]: Job pending for unit, delaying automatic restart.
    Feb 19 11:14:05 localhost systemd[1]: Unit mysqld.service entered failed state.
    Feb 19 11:14:05 localhost mysqld_safe[4123]: 120219 11:14:05 mysqld_safe Logging to ‘/var/log/mysqld.log’.
    Feb 19 11:14:06 localhost mysqld_safe[4123]: 120219 11:14:06 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    Feb 19 11:14:07 localhost systemd[1]: mysqld.service: main process exited, code=exited, status=1
    Feb 19 11:14:08 localhost systemd[1]: mysqld.service: control process exited, code=exited status=1
    Feb 19 11:14:08 localhost systemd[1]: mysqld.service holdoff time over, scheduling restart.
    Feb 19 11:14:08 localhost systemd[1]: Job pending for unit, delaying automatic restart.
    Feb 19 11:14:08 localhost systemd[1]: Unit mysqld.service entered failed state.
    Feb 19 11:14:08 localhost mysqld_safe[4330]: 120219 11:14:08 mysqld_safe Logging to ‘/var/log/mysqld.log’.
    Feb 19 11:14:08 localhost mysqld_safe[4330]: 120219 11:14:08 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    Feb 19 11:14:09 localhost systemd[1]: mysqld.service: main process exited, code=exited, status=1
    Feb 19 11:14:10 localhost systemd[1]: mysqld.service: control process exited, code=exited status=1
    Feb 19 11:14:10 localhost systemd[1]: mysqld.service holdoff time over, scheduling restart.
    Feb 19 11:14:10 localhost systemd[1]: Job pending for unit, delaying automatic restart.
    Feb 19 11:14:10 localhost systemd[1]: Unit mysqld.service entered failed state.
    Feb 19 11:14:10 localhost mysqld_safe[4535]: 120219 11:14:10 mysqld_safe Logging to ‘/var/log/mysqld.log’.
    Feb 19 11:14:10 localhost mysqld_safe[4535]: 120219 11:14:10 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    Feb 19 11:14:12 localhost systemd[1]: mysqld.service: main process exited, code=exited, status=1
    Feb 19 11:14:13 localhost systemd[1]: mysqld.service: control process exited, code=exited status=1
    Feb 19 11:14:13 localhost systemd[1]: mysqld.service holdoff time over, scheduling restart.
    Feb 19 11:14:13 localhost systemd[1]: Job pending for unit, delaying automatic restart.
    Feb 19 11:14:13 localhost systemd[1]: Unit mysqld.service entered failed state.
    Feb 19 11:14:13 localhost mysqld_safe[4741]: 120219 11:14:13 mysqld_safe Logging to ‘/var/log/mysqld.log’.
    Feb 19 11:14:13 localhost mysqld_safe[4741]: 120219 11:14:13 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    Feb 19 11:14:14 localhost systemd[1]: mysqld.service: main process exited, code=exited, status=1
    Feb 19 11:14:15 localhost systemd[1]: mysqld.service: control process exited, code=exited status=1
    Feb 19 11:14:15 localhost systemd[1]: mysqld.service holdoff time over, scheduling restart.
    Feb 19 11:14:15 localhost systemd[1]: Job pending for unit, delaying automatic restart.
    Feb 19 11:14:15 localhost systemd[1]: Unit mysqld.service entered failed state.
    Feb 19 11:14:15 localhost mysqld_safe[4947]: 120219 11:14:15 mysqld_safe Logging to ‘/var/log/mysqld.log’.
    Feb 19 11:14:15 localhost mysqld_safe[4947]: 120219 11:14:15 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    Feb 19 11:14:17 localhost systemd[1]: mysqld.service: main process exited, code=exited, status=1
    Feb 19 11:14:17 localhost systemd[1]: mysqld.service: control process exited, code=exited status=1
    Feb 19 11:14:18 localhost systemd[1]: mysqld.service holdoff time over, scheduling restart.
    Feb 19 11:14:18 localhost systemd[1]: Job pending for unit, delaying automatic restart.
    Feb 19 11:14:18 localhost systemd[1]: Unit mysqld.service entered failed state.

  20. output of /var/log/mysqld.log : its also too long
    120219 11:13:58 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    120219 11:13:58 [Note] Plugin ‘FEDERATED’ is disabled.
    120219 11:13:58 InnoDB: The InnoDB memory heap is disabled
    120219 11:13:58 InnoDB: Mutexes and rw_locks use GCC atomic builtins
    120219 11:13:58 InnoDB: Compressed tables use zlib 1.2.5
    120219 11:13:58 InnoDB: Using Linux native AIO
    120219 11:13:58 InnoDB: Initializing buffer pool, size = 128.0M
    120219 11:13:58 InnoDB: Completed initialization of buffer pool
    120219 11:13:58 InnoDB: highest supported file format is Barracuda.
    120219 11:13:59 InnoDB: Waiting for the background threads to start
    120219 11:14:00 InnoDB: 1.1.8 started; log sequence number 1602861
    120219 11:14:00 [ERROR] /usr/libexec/mysqld: Incorrect information in file: ‘./mysql/proxies_priv.frm’
    120219 11:14:00 [ERROR] Fatal error: Can’t open and lock privilege tables: Incorrect information in file: ‘./mysql/proxies_priv.frm’
    120219 11:14:01 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    120219 11:14:01 [Note] Plugin ‘FEDERATED’ is disabled.
    120219 11:14:01 InnoDB: The InnoDB memory heap is disabled
    120219 11:14:01 InnoDB: Mutexes and rw_locks use GCC atomic builtins
    120219 11:14:01 InnoDB: Compressed tables use zlib 1.2.5
    120219 11:14:01 InnoDB: Using Linux native AIO

  21. Now the output is changed after updated
    [root@localhost sam]# systemctl status mysqld.service
    mysqld.service – MySQL database server
    Loaded: loaded (/lib/systemd/system/mysqld.service; disabled)
    Active: activating (start-post) since Sun, 19 Feb 2012 11:45:07 +0530; 2s ago
    Process: 30991 ExecStart=/usr/bin/mysqld_safe –nowatch –basedir=/usr (code=exited, status=0/SUCCESS)
    Process: 30975 ExecStartPre=/usr/libexec/mysqld-prepare-db-dir (code=exited, status=0/SUCCESS)
    Main PID: 31127 (code=exited, status=1/FAILURE); Control: 31128 (mysqld-wait-rea)
    CGroup: name=systemd:/system/mysqld.service
    ├ 31128 /bin/sh /usr/libexec/mysqld-wait-ready 31127
    └ 31170 sleep 1

  22. Hi again SAM,

    Could you also post output of following commands:

    uname -a
     
    lsb_release -a
     
    cat /etc/my.cnf
     
    rpm -qa \*mysql\*

    Are you updating MySQL from older version like 5.0 or 5.1?

    Thanks!

    • Hi JR,
      No just i run simple command yum install mysql mysql-server

      [sam@localhost ~]$ uname -a
      Linux localhost 3.1.0-7.fc16.x86_64 #1 SMP Tue Nov 1 21:10:48 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

      [root@localhost sam]# lsb_release -a
      bash: lsb_release: command not found…

      [root@localhost sam]# cat /etc/my.cnf
      [mysqld]
      # Settings user and group are ignored when systemd is used.
      # If you need to run mysqld under different user or group,
      # customize your systemd unit file for mysqld according to the
      # instructions in http://fedoraproject.org/wiki/Systemd
      datadir=/var/lib/mysql
      socket=/var/lib/mysql/mysql.sock
      # Disabling symbolic-links is recommended to prevent assorted security risks
      symbolic-links=0
      [mysqld_safe]
      log-error=/var/log/mysqld.log
      pid-file=/var/run/mysqld/mysqld.pid

      [root@localhost sam]# rpm -qa \*mysql\*
      mysql-server-5.5.20-1.fc16.x86_64
      mysql-connector-python-0.3.2-2.fc16.noarch
      mysql-workbench-5.2.37-1.fc16.x86_64
      mysql-libs-5.5.20-1.fc16.x86_64
      mysql-utilities-1.0.3-0.5.2.37.fc16.noarch
      mysql-5.5.20-1.fc16.x86_64

      • I just tried to install MySQL 5.5.20 on Fedora 16 clean install and it works just normally.

        If you don’t have any dbs yet, then I recommend you to try reinstall MySQL with following procedure:

        yum remove mysql mysql-server mysql-libs mysql-utilities mysql-connector-python mysql-workbench
         
        rm -rf /var/lib/mysql
         
        yum update
         
        reboot

        Then install just mysql and mysql-server and try to start it:

        yum install mysql mysql-server
         
        systemctl start mysqld.service

        Is it starting then?

        • Hi JR,
          Many many thanks. I got success, mysql is running on my system. If u don’t mind then could u tell me what was the problem. Still i don’t get the problem.
          Again Thanks thanks …..many thanks.

          • Hi SAM,

            You are welcome! Excellent to hear that you got it working! :)

            Your mysqld.log file errors:

            120219 11:14:00 [ERROR] /usr/libexec/mysqld: Incorrect information in file: ‘./mysql/proxies_priv.frm’
            120219 11:14:00 [ERROR] Fatal error: Can’t open and lock privilege tables: Incorrect information in file: ‘./mysql/proxies_priv.frm’

            Tells that the proxies_priv.frm is broken/corrupted, so I guess that at this situation, when you don’t have any own DBs, it’s easiest to reinstall whole MySQL. So without any access to your Linux, I can’t tell specific reason what had happened to proxies_priv.frm file…


  23. > yum --enablerepo=remi,remi-test list mysql mysql-server
    Loaded plugins: fastestmirror
    ......
    Available Packages
    mysql.i386 5.5.21-3.el5.art atomic
    mysql-server.i386 5.5.21-3.el5.art atomic

    Everything is ok here.

    > yum --enablerepo=remi install mysql
    ......
    Installed:
    mysql.i386 0:5.5.21-3.el5.art

    Complete!

    Here, too.

    But here the problems begin:

    > yum --enablerepo=remi install mysql-server
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    * atomic: www6.atomicorp.com
    * base: mirror.corbina.net
    * epel: mirror.xfes.ru
    * extras: mirror.corbina.net
    * ius: mirrors.ircam.fr
    * remi: remi-mirror.dedipower.com
    * rpmfusion-free-updates: mirror.yandex.ru
    * rpmfusion-free-updates-testing: mirror.yandex.ru
    * updates: mirror.corbina.net
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package mysql-server.i386 0:5.5.21-3.el5.art set to be updated
    --> Processing Dependency: libaio.so.1(LIBAIO_0.4) for package: mysql-server
    --> Processing Dependency: libaio.so.1 for package: mysql-server
    --> Processing Dependency: libaio.so.1(LIBAIO_0.1) for package: mysql-server
    --> Processing Dependency: perl-DBD-MySQL for package: mysql-server
    --> Running transaction check
    ---> Package libaio.i386 0:0.3.106-5 set to be updated
    ---> Package perl-DBD-MySQL.i386 0:3.0007-2.el5 set to be updated
    --> Processing Dependency: libmysqlclient.so.15 for package: perl-DBD-MySQL
    --> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15) for package: perl-DBD-MySQL
    --> Running transaction check
    ---> Package mysql50.i386 0:5.0.92-1.ius.el5 set to be updated
    --> Processing Conflict: mysql50 conflicts MySQL
    --> Finished Dependency Resolution
    mysql50-5.0.92-1.ius.el5.i386 from ius has depsolving problems
    --> mysql50 conflicts with mysql
    Error: mysql50 conflicts with mysql

    You could try using --skip-broken to work around the problem
    You could try running: package-cleanup --problems
    package-cleanup --dupes
    rpm -Va --nofiles --nodigest
    The program package-cleanup is found in the yum-utils package.

    Maybe you can help with that.

    • Do you have any MySQL database (running) on your VPS?

      COuld you post output of following command:

      rpm -qa \*mysql\*
      • Yes, 9 databases. But now, MySQL does not work after attempting to upgrade =(


        > rpm -qa \*mysql\*
        mysql-libs-5.5.21-3.el5.art
        mysql-5.5.21-3.el5.art
        php-mysql-5.3.10-5.el5.art
        mysqlclient15-5.0.92-1.ius.el5
        mysql-server-5.5.21-3.el5.art

  24. Hi JR. I’m new to linux,hope u can help me.I’ve got this error message when trying to test remote connection

    ERROR 2005 (HY000): Unknown MySQL server host ‘dbserver_name_or_ip_address’ (0).

    what’s that mean?

    • Hi Malik,

      This dbserver_name_or_ip_address is just place, where you have to write your own MySQL host. If you have own MySQL server running on ip address 10.0.0.15, then you can connect using following command:

      mysql -h 10.0.0.15 -u your_user -p your_db
      • i try that
        then i got this message

        ERROR 1045 (28000): Access denied for user ‘webdb_user’@'localhost’ (using password: YES)

        my user is webdb_user and db is webdb

        please help me.

        • Then command is:

          mysql -h localhost -u webdb_user -p webdb

          Do you have grant access from localhost to your db?

          GRANT ALL ON webdb.* TO webdb_user@localhost;
  25. yes i have do that

    GRANT ALL ON webdb.* TO webdb_user@localhost;

    but same error come out.

    ERROR 1045 (28000): Access denied for user ‘webdb_user’@'localhost’ (using password: YES)

    sorry if my english is bad.

  26. Thank you JR.My problem has been fixed.I’ve create another database. Sorry if i troubling you.Thanks again for ur help. ;)

    • You are welcome! Excellent to hear that you got it working! :)

  27. Hi JR.

    This is the best tutorial I found to install mysql 5.5 on Centos 6.2
    Thanks for your wasted time on teaching us how to do that!

    Have a nice day!

  28. /usr/bin/mysql_secure_installation,come to this step, problem happened.i got

    In order to log into MySQL to secure it, we’ll need the current
    password for the root user. If you’ve just installed MySQL, and
    you haven’t set the root password yet, the password will be blank,
    so you should just press enter here.

    Enter current password for root (enter for none):
    ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: NO)

    • Hi HuangMinghe,

      Do you have current MySQL root password?

  29. I just installed sql and some how the password I put in got change when seting the system up now i cant do nouthing with out the password how can i just reset everthing? I tryed to remove and reinstall but that wouldent work Thanks

    • Hi steve,

      You could try to remove whole mysql with following command:

      yum remove mysql mysql-server mysql-libs

      Then reinstall it. Is it helping?

  30. Hi JR
    Further step 6, don’t you recommend to use the “password ()” function to store the password wherever it’s stored?. The script, as shown in here, seems non include that option. I see I could do it out of the script as guided in step 7 but which are then, the commands for removing anonymous user, disallow login remotely and delete the test data base manually, I mean, out of the script?
    I’d appreciate any clue on this question.
    Anyway, its been very instructive, as someone above said this is one of the best tutorials currently available online on this question.
    Txe.

  31. Hi, i am totally new at installing mysql. Can you please help me …..
    I have installed Fedora 16 (x64 bit) on my laptop.
    I continued till the Update process. (Used su -, yum list msql mysql-server and after that yum install mysql mysql-server)
    Then i restarted my computer. Then again proceed by su – and used the command ‘systemctl start mysqld.service’ and i got the following output.
    [BoNeLeSs@BoNeLeSs ~]$ su -
    Password:
    [root@BoNeLeSs ~]# systemctl start mysqld.service
    Job failed. See system logs and ‘systemctl status’ for details.
    So what should i do now.
    Sorry for the English, and please tell me in full detail because i am very very new to this and trying to learn sql.
    Also please tell me about installing psql :)

    • Hi Vineet,

      Could you post output of following commands:

      systemctl status mysqld.service
       
      tail -n 100 /var/log/mysqld.log
  32. Hi,
    I am extremely sorry for the late reply, actually had more problems with fedora 16. i think i messed up things.
    Anyway i reinstalled Fedora 16 and proceed with the same steps and got the following:

    [BoNeLeSs@BoNeLeSs ~]$ su -
    Password:
    [root@BoNeLeSs ~]# systemctl start mysqld.service
    Job failed. See system logs and ‘systemctl status’ for details.
    [root@BoNeLeSs ~]# systemctl status mysqld.service
    mysqld.service – MySQL database server
    Loaded: loaded (/lib/systemd/system/mysqld.service; disabled)
    Active: activating (start-pre) since Mon, 23 Apr 2012 15:05:44 +0530; 401ms ago
    Control: 2144 (sd(EXEC))
    CGroup: name=systemd:/system/mysqld.service
    └ 2144 sd(EXEC)
    [root@BoNeLeSs ~]# tail -n 100 /var/log/mysqld.log
    [root@BoNeLeSs ~]# tail -n 100 /var/log/mysqld.log
    [root@BoNeLeSs ~]#

    This is when i restarted my computer and used the commands.
    Thank You !!

    • Hi Vineet,

      No problem at all… :)

      Could you run systemctl restart mysqld.service and then wait a moment and run:

      systemctl status mysqld.service

      Is your /var/log/mysqld.log totally empty after this?

      Could you also post output of following commands:

      grep mysqld /var/log/audit/audit.log
       
      grep mysqld /var/log/messages
  33. Hi JR,
    Well this is what i have after executing the commands that were specified :

    [BoNeLeSs@BoNeLeSs ~]$ su -
    Password:
    [root@BoNeLeSs ~]# systemctl restart mysqld.service
    Job failed. See system logs and ‘systemctl status’ for details.
    [root@BoNeLeSs ~]#
    [root@BoNeLeSs ~]# systemctl status mysqld.service
    mysqld.service – MySQL database server
    Loaded: loaded (/lib/systemd/system/mysqld.service; disabled)
    Active: activating (start-pre) since Mon, 23 Apr 2012 17:52:38 +0530; 22s ago
    Control: 2091 (sd(EXEC))
    CGroup: name=systemd:/system/mysqld.service
    └ 2091 sd(EXEC)
    [root@BoNeLeSs ~]#
    [root@BoNeLeSs ~]# /var/log/mysqld.log
    -bash: /var/log/mysqld.log: Permission denied
    [root@BoNeLeSs ~]#
    [root@BoNeLeSs ~]# grep mysqld /var/log/audit/audit.log
    type=SERVICE_START msg=audit(1335173732.688:100): user pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg=’: comm=”mysqld” exe=”/bin/systemd” hostname=? addr=? terminal=? res=failed’
    type=SERVICE_START msg=audit(1335173732.894:101): user pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg=’: comm=”mysqld” exe=”/bin/systemd” hostname=? addr=? terminal=? res=failed’
    type=SERVICE_START msg=audit(1335173744.578:102): user pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg=’: comm=”mysqld” exe=”/bin/systemd” hostname=? addr=? terminal=? res=failed’
    type=SERVICE_START msg=audit(1335183235.569:91): user pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg=’: comm=”mysqld” exe=”/bin/systemd” hostname=? addr=? terminal=? res=failed’
    type=SERVICE_START msg=audit(1335183235.840:92): user pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg=’: comm=”mysqld” exe=”/bin/systemd” hostname=? addr=? terminal=? res=failed’
    type=SERVICE_START msg=audit(1335183247.152:93): user pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg=’: comm=”mysqld” exe=”/bin/systemd” hostname=? addr=? terminal=? res=failed’
    type=SERVICE_START msg=audit(1335183746.789:93): user pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg=’: comm=”mysqld” exe=”/bin/systemd” hostname=? addr=? terminal=? res=failed’
    type=SERVICE_START msg=audit(1335183746.997:94): user pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg=’: comm=”mysqld” exe=”/bin/systemd” hostname=? addr=? terminal=? res=failed’
    type=SERVICE_START msg=audit(1335183758.154:95): user pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg=’: comm=”mysqld” exe=”/bin/systemd” hostname=? addr=? terminal=? res=failed’

    Apr 23 17:43:55 BoNeLeSs systemd[1]: mysqld.service holdoff time over, scheduling restart.
    Apr 23 17:43:55 BoNeLeSs systemd[1]: Unit mysqld.service entered failed state.
    Apr 23 17:43:55 BoNeLeSs systemd[1]: mysqld.service: control process exited, code=exited status=254
    Apr 23 17:43:55 BoNeLeSs systemd[1]: mysqld.service holdoff time over, scheduling restart.
    Apr 23 17:43:55 BoNeLeSs systemd[1]: Unit mysqld.service entered failed state.
    Apr 23 17:44:07 BoNeLeSs systemd[1]: mysqld.service: control process exited, code=exited status=254
    Apr 23 17:44:07 BoNeLeSs systemd[1]: mysqld.service holdoff time over, scheduling restart.
    Apr 23 17:44:07 BoNeLeSs systemd[1]: Unit mysqld.service entered failed state.
    Apr 23 17:52:26 BoNeLeSs systemd[1]: mysqld.service: control process exited, code=exited status=254
    Apr 23 17:52:26 BoNeLeSs systemd[1]: mysqld.service holdoff time over, scheduling restart.
    Apr 23 17:52:26 BoNeLeSs systemd[1]: Unit mysqld.service entered failed state.
    Apr 23 17:52:26 BoNeLeSs systemd[1]: mysqld.service: control process exited, code=exited status=254
    Apr 23 17:52:26 BoNeLeSs systemd[1]: mysqld.service holdoff time over, scheduling restart.
    Apr 23 17:52:26 BoNeLeSs systemd[1]: Unit mysqld.service entered failed state.
    Apr 23 17:52:38 BoNeLeSs systemd[1]: mysqld.service: control process exited, code=exited status=254
    Apr 23 17:52:38 BoNeLeSs systemd[1]: mysqld.service holdoff time over, scheduling restart.
    Apr 23 17:52:38 BoNeLeSs systemd[1]: Unit mysqld.service entered failed state.
    [root@BoNeLeSs ~]#

    Thank You.

    • Hi again Vineet and thanks for this information.

      Plase could you also post output of following commands:

      rpm -qa *selinux* mysql* |sort
       
      grep -v ^"#" /etc/sysconfig/selinux
       
      uname -a
  34. Hello JR,

    Well you are helping me out !! No need to say thanks :P . I owe you :) .
    This is the output of the commands :

    [BoNeLeSs@BoNeLeSs ~]$ su -
    Password:
    [root@BoNeLeSs ~]# rpm -qa *selinux* mysql* |sort
    libselinux-2.1.5-5.1.fc16.x86_64
    libselinux-devel-2.1.5-5.1.fc16.x86_64
    libselinux-python-2.1.5-5.1.fc16.x86_64
    libselinux-utils-2.1.5-5.1.fc16.x86_64
    mysql-5.5.22-1.fc16.x86_64
    mysql-connector-java-5.1.17-1.fc16.1.x86_64
    mysql-connector-odbc-5.1.8-3.fc16.x86_64
    mysql-embedded-5.5.14-3.fc16.x86_64
    mysql-libs-5.5.22-1.fc16.x86_64
    mysql-server-5.5.22-1.fc16.x86_64
    selinux-policy-3.10.0-46.fc16.noarch
    selinux-policy-targeted-3.10.0-46.fc16.noarch
    [root@BoNeLeSs ~]#
    [root@BoNeLeSs ~]# grep -v ^”#” /etc/sysconfig/selinux

    SELINUX=enforcing
    SELINUXTYPE=targeted

    [root@BoNeLeSs ~]#
    [root@BoNeLeSs ~]# uname -a
    Linux BoNeLeSs 3.1.0-7.fc16.x86_64 #1 SMP Tue Nov 1 21:10:48 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
    [root@BoNeLeSs ~]#

    Thank You JR.

    • This looks like old SELinux bug, please try to update your system:

      yum update

      Then reboot and try to start MySQL again, does it start normally then?

  35. Hi JR,

    Thanks for guiding me through the process, its all done finally.
    I ll join the community for sure :).
    Just want to become a class programmer :P

    #include
    void main ()
    {
     for(;;)
      printf("Thank You JR !!);
    }

    This is just a prank to say thank you im my way :)
    I am toooo Happy :)
    Thank You JR.

    • Yeah n sorry for the mistake. Forgot to put the ” for printf statement :P

      • You are welcome Vineet! And thank you! :)

  36. Hi JR,

    Figured I’d stick this “solution” here, as I’ve used your site for other CentOS things, and this is a normal problem with a new CenOS install (DVD) where someone selects mysql (also Apache) during system build.

    [root@localhost]# mysql_secure_installation

    {snip}

    Enter current password for root (enter for none):
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

    Solution: Start mysql…

    [Gnome] Menu – System > Administration > Services

    Select ‘mysqld’ > click “Enable” > click “Start”
    Verify runlevels: click “Customize” (should have at least runlevel 5 checked)

    Rinse and repeat for ‘httpd’ if you want Apache running as well.

    # # #

    I’ll leave off questions as to why the services aren’t setup correctly when installed along with the OS…

    Best,
    Michael

  37. 5.5.25 is out :)

  38. Hello,
    It seems that the repository has been moved. Any comments on this error?

    yum --enablerepo=remi,remi-test list mysql mysql-server
    Could not retrieve mirrorlist http://rpms.famillecollet.com/enterprise/5.30/test/mirror error was
    [Errno 14] HTTP Error 404: Not Found
    Error: Cannot retrieve repository metadata (repomd.xml) for repository: remi-test. Please verify its path and try again

  39. The Remi dependencies link for CentOS6.2 are not working.
    I’ve used:

    rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm

    All worked fine for me.
    Cheers,
    M

  40. Get this error when trying to install remi repository

    [root@f17desktop1 ~]# rpm -Uvh http://rpms.famillecollet.com/remi-release-17.rpm
    Retrieving http://rpms.famillecollet.com/remi-release-17.rpm
    warning: /var/tmp/rpm-tmp.rB9fQQ: Header V3 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
    Preparing… ########################################### [100%]
    1:remi-release ########################################### [100%]
    /usr/bin/sed: can’t read /etc/smart/channels/remi.channel: No such file or directory
    warning: %post(remi-release-17-6.fc17.remi.noarch) scriptlet failed, exit status 2

    Here is my OS info:

    uname -r
    3.4.2-4.fc17.x86_64

    Thanks

  41. What MySQL download was used ? Source Code of Generic Linux and after compiled with CMake ? The site haven’t Fedora instalation …

  42. please help..
    when i start secure installation for mySql.
    they ask for root password which should be blank.
    but there i got stuck with this message..
    [root@dev ~]# /usr/bin/mysql_secure_installation

    Enter current password for root (enter for none):
    ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
    Enter current password for root (enter for none):

    • Hi Devang,

      Do you have mysqld running?

      • Hi JR,

        I hope you can guide me. I have installed CentOS 6.2 and reinstall mysql5.5.27(since the default was mysql 5.1). I want to change the default datadir to another partition. But the thing is, I cannot find the “my.cnf” file. No file from “/etc/my.cnf”.

        I’ve tried to run this:
        [root@ilpimysql /]# find / -name “*my*cnf”
        /usr/share/doc/MySQL-server-5.5.27/my-small.cnf
        /usr/share/doc/MySQL-server-5.5.27/my-large.cnf
        /usr/share/doc/MySQL-server-5.5.27/my-medium.cnf
        /usr/share/doc/MySQL-server-5.5.27/my-huge.cnf
        /usr/share/doc/MySQL-server-5.5.27/my-innodb-heavy-4G.cnf
        /usr/share/mysql/my-small.cnf
        /usr/share/mysql/my-large.cnf
        /usr/share/mysql/my-medium.cnf
        /usr/share/mysql/my-huge.cnf
        /usr/share/mysql/my-innodb-heavy-4G.cnf
        [root@ilpimysql /]#

        Did I miss something during installation? I hope you can guide me. thank you in advance.

        • Hi yirvineox,

          /etc/my.cnf file belongs to mysql-libs package. So you can try following:

          ## reinstall mysql-libs ##
          yum --enablerepo=remi reinstall mysql-libs
           
          ## or reinstall all mysql packages ##
          yum --enablerepo=remi reinstall mysql-libs mysql mysql-server
  43. hi JR,

    I’ve tried youre steps and this is the result.

    root@ilpimysql /]# yum –enablerepo=remi reinstall mysql-libs
    Loaded plugins: fastestmirror, security
    Loading mirror speeds from cached hostfile
    * base: centos.ipserverone.com
    * epel: http://ftp.riken.jp
    * extras: centos.ipserverone.com
    * remi: remirpm.mirror.gymkl.ch
    * rpmforge: mirror.oscc.org.my
    * updates: mirrors.hostemo.com
    Setting up Reinstall Process
    Installed package MySQL-shared-compat-5.5.27-1.linux2.6.x86_64 not available.
    Nothing to do
    [root@ilpimysql /]#

    [root@ilpimysql /]# yum –enablerepo=remi reinstall mysql-libs mysql mysql-server
    Loaded plugins: fastestmirror, security
    Loading mirror speeds from cached hostfile
    * base: centos.ipserverone.com
    * epel: http://ftp.riken.jp
    * extras: centos.ipserverone.com
    * remi: remirpm.mirror.gymkl.ch
    * rpmforge: http://ftp.riken.jp
    * updates: mirrors.hostemo.com
    Setting up Reinstall Process
    Installed package MySQL-shared-compat-5.5.27-1.linux2.6.x86_64 not available.
    Installed package MySQL-server-5.5.27-1.linux2.6.x86_64 not available.
    Installed package MySQL-server-5.5.27-1.linux2.6.x86_64 not available.
    Nothing to do
    [root@ilpimysql /]#

    I guess it failed. Do I need to remove MySQL5.5.27 and install it again?

    • Yes, it failed. You can remove MySQL installation (at least mysql-libs mysql mysql-server) and then install it again.

  44. Hi,

    it seems to me that this line: GRANT ALL ON webdb.* TO webdb_user@’10.0.15.25′;
    should look like this: GRANT ALL ON webdb.* TO ‘webdb_user’@’10.0.15.25′;

    :)

    • Hi galanonim,

      Thank you, I fixed it. :)

  45. Hi JR,

    Thank you for your quick response.

    I have successfully reinstalled mysql5.5.27 using your guide. I’ve copied the /var/lib/mysql and change the datadir and socket path to my desired location. When I start the mysql service, it failed.

    This is the steps I’ve followed to change the datadir:

    [root@ilpimysql mysql_data]# /etc/init.d/mysqld stop
    [root@ilpimysql mysql_data]# cp -R -p /var/lib/mysql /diskmnt/data1/mysql_data/mysql
    [root@ilpimysql mysql_data]# nano /etc/mysql/my.cnf
     
     I have modified the ff:
     datadir=/diskmnt/data1/mysql_data/mysql
     socket=/diskmnt/data1/mysql_data/mysql/mysql.sock
     
    [root@ilpimysql mysql_data]# /etc/init.d/mysqld start

    Status is “Failed” when i start the service. The owner of new directory “/diskmnt/data1/mysql_data/mysql” is mysql, same rights and owner from “/var/lib/mysql”. Also, “diskmnt/data1″ is ext4 partition that is auto mounted at startup using fstab. Did I mis something? I hope you can direct me. Thank you.

  46. Hi JR,

    Good news! I’ve successfully started the mysql service with the new datadir. It seems I need to configure also the SELinux, since it was enable by default during CentOS installation. The link below help me a lot to pinpoint the problem.

    Moving MySQL Data Directory in CentOS with SELinux:

    http://crashmag.net/change-the-default-mysql-data-directory-with-selinux-enabled

    I carefully followed the instruction in the link but failed when I start the mysql service. It seems SELinux causes this behavior. What I did, is to reboot(restart) the server after applying the “semanage” and “restorecon”.

    For all the people out there trying to move datadir, this is the step. Follow the instruction in the link until you reached here,

    # semanage fcontext -a -t mysqld_db_t "/diskmnt/data1/mysql_data/mysql(/.*)?"

    then apply restorecon command to apply context mapping,

    # restorecon -Rv /diskmnt/data1/mysql_data/mysql

    As suggested in the link, I can start the mysql services

    # service mysqld start

    Since mine has failed when I start the mysql service, I decided to restart/reboot the Server, cause I was thinking may be the SELinux still looking/expecting for the default datadir ‘/var/lib/mysql’. After rebooting the server, I expect that the changes made in SELinux has been loaded or something like that. Then mysql services has started successfully after invoking “/etc/init.d/mysqld start”.

    • Hi yirvineox,

      Thank you for this info!

      And very nice to hear that you got mysqld running as you wanted.

  47. yum install mysql mysql-server
    cannot retreive repositry metadata(repomd.xml) repository. fedora. please verify path and try again

    • Hi paras,

      Is your network connection working normally?

      Could you post full error message and output of following commands:

      uname -a
       
      lsb_release -a
       
      cat /etc/yum.repos.d/fedora.repo
  48. I want to test remote connection, however I unable how to do it!
    I entered following command:

    mysql -h 127.0.0.1 -u webdeb_user -p webdeb
    Enter password:
    ERROR 1045 (28000): Access denied for user ‘webdeb_user’@'localhost’ (using password: YES)

    why the access is denying?
    pls somebody reply.

    • Hi navid,

      If you want to test remote connection, then why you are using localhost ip (127.0.0.1)?

      Btw. Did you created webdeb or webdb database? And did you created webdeb_user or webdb_user?

      • Hi JR,
        yes, I found where I was making mistake, my peer showed me howto do that, and explained too. Thank you JR.

  49. While Enabling remote connection to host, using these steps I was getting error 113.

    I come to know that I need flush the iptable rule!(I dont know the term I used is correct or not, but the meaning is same) using command:

    >iptables -F

  50. Hey there JR every time i try to start the mysql server i get “Job failed. See system logs and ‘systemctl status’ for details.”
    Im running Fedora 16 64Bit, thanks in advanced.

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackbacks/Pingbacks