当前位置:Gxlcms > mysql > Ubuntu13.10编译安装MySQL5.6_MySQL

Ubuntu13.10编译安装MySQL5.6_MySQL

时间:2021-07-01 10:21:17 帮助过:19人阅读

Ubuntu

1.下载MySQL5.6源码包


2.解压 tar -zxvf mysql*****.tar.gz 压缩包与tar后的文件不要放在一个目录中


3.复制文件到 /usr/local/mysql

cp -vRp mysql*** /usr/local/mysql


4.添加mysql组 groupadd mysql


5.添加mysql用户 useradd -r -g mysql mysql


6.安装gcc

sudo apt-get install build-essential gcc g++ libncurses5-dev


7.安装Bison

sudo apt-get install Bison


8.cmake
如果需要重新cmake,则需要删除之前生产的CMakeCache.txt
cmake
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql /
-DMYSQL_DATADIR=/usr/local/mysql/data /
-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock /
-DDEFAULT_CHARSET=utf8 /
-DDEFAULT_COLLATION=utf8_general_ci /
-DEXTRA_CHARSETS=all
-DWITH_MYISAM_STORAGE_ENGINE=1 /
-DWITH_INNOBASE_STORAGE_ENGINE=1 /
-DENABLED_LOCAL_INFILE=1 /

-DENABLE_DOWNLOADS=1


9.make


10.make install


11.设置MySQL安装目录权限 chown -R mysql:mysql /usr/local/mysql


12.查看scripts/mysql_install_db的权限 ls -l scripts/mysql_install_db

如果没有x权限,则 chmod +x /usr/local/mysql/scripts/mysql_install_db

13.初始化MySQL scripts/mysql_install_db --user=mysql


14.复制权限文件 cp support-files/mysql.server /etc/init.d/mysqld


15.重命名权限文件 mv /etc/init.d/mysqld/mysql.server /etc/init.d/mysqld/mysqld.server


16.修改MySQL安装目录权限 chown -R root /usr/local/mysql


17.修改mysql/data目录权限 chown -R mysql /usr/local/mysql/data


18.启动MySQL bin/mysqld_safe --user=mysql &


19.进入mysql bin/mysql -u root


20.给root用户添加密码 bin/mysqladmin -u root password 'root'


21.复制my.cnf配置文件 cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf

人气教程排行