首页 >数据库 >mysql教程 >mysql在centos上的编译安装

mysql在centos上的编译安装

WBOY
WBOY原创
2016-06-01 13:16:02841浏览

CentOS

环境:centos6.5  mysql-5.6.17.tar.gz

wgethttp://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.17.tar.gz

yum install -y gcc gcc-c++ gcc-c++.x86_64 bison.x86_64 libaio.x86_64 cmake.x86_64 ncurses-devel.x86_64

后面根据官方文档: MySQL 5.6 Manual 2.8.2 Installing MySQL Using a Standard Source Distribution

<code>shell></code><strong><code> groupadd mysql</code></strong>shell> <strong><code>useradd -r -g mysql mysql<br></code></strong>
shell> <strong><code>tar zxvf mysql-<em><code>VERSION</code></em>.tar.gz</code></strong>shell> <strong><code>cd mysql-<em><code>VERSION</code></em></code></strong>shell> <strong><code>cmake .</code></strong>shell> <strong><code>make</code></strong>shell> <strong><code>make install<br></code></strong>shell> <strong><code>cd /usr/local/mysql</code></strong>shell> <strong><code>chown -R mysql .</code></strong>shell> <strong><code>chgrp -R mysql .</code></strong>shell> <strong><code>scripts/mysql_install_db --user=mysql</code></strong>shell> <strong><code>chown -R root .</code></strong>shell> <strong><code>chown -R mysql data</code></strong>shell> <strong><code>bin/mysqld_safe --user=mysql &<br>安装完了 ,启动的时候就报错:<br>/usr/local/mysql/bin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 2 - No such file or directory)<br>cd /var/run/<br>mkdir mysqld<br>chown -R mysql mysqld<br>chgrp -R mysql mysqld<br>再重新启动:<br>[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist<br>修改:/usr/local/mysql/my.cnf<br>datadir =/usr/local/mysql/data<br>重启电脑 <br>mysql.server start 启动成功<br>./bin/mysql<br>ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)<br>ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock<br>执行这个命令后,成功运行mysql<br></code></strong>
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn