码迷,mamicode.com
首页 > 数据库 > 详细

lamp环境搭建之编译安装mysql

时间:2018-10-26 22:18:52      阅读:244      评论:0      收藏:0      [点我收藏+]

标签:ble   memory   source   tao   engine   mysqld   pts   配置   5.6   

mysql 编译安装
1,在网站上下载: wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.15.tar.gz

2,安装cmake yum安装即可。(“CMake”这个名字是“cross platform make”的缩写,)

3,cmake使用报错:
-- The CXX compiler identification is unknown
CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found.
Please set CMAKE_CXX_COMPILER to a valid compiler path or name.

解决:报错大致都是缺少依赖包,安装这些就差不多了
yum install -y git gcc gcc-c++ ncurses-devel bison

4,再次执行cmake命令
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci

5,make && make install

6,报错 make[2]: *** [sql/CMakeFiles/sql.dir/mysqld.cc.o] Error 1
make[1]: *** [sql/CMakeFiles/sql.dir/all] Error 2
make: *** [all] Error 2

解决:make clean
rm CMakeCache.txt

7,创建mysql用户和用户组,更改mysql 目录的默认用户
groupadd mysql
useradd mysql -g mysql -s /sbin/nologin
chown -R mysql:mysql /usr/local/mysql

8,复制配置文件到/etc 目录下
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf

9,添加到环境变量中
echo ‘export PATH=/usr/local/mysql/bin:$PATH‘ >> /etc/profile
source /etc/profile

10,添加进启动项
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

11,初始化mysql数据库报错:
FATAL ERROR: Could not find ./bin/my_print_defaults
解决:在/bin 目录下看能否找到 这个文件,如果有,就到安装目录以相对路劲执行。
如下:./scripts/mysql_install_db --defaults-file=/etc/my.cnf --user=mysql

12,PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

./bin/mysqladmin -u root password ‘new-password‘ #更改mysql的root密码
./bin/mysqladmin -u root -h tao-ffy.ffy.com password ‘new-pass

lamp环境搭建之编译安装mysql

标签:ble   memory   source   tao   engine   mysqld   pts   配置   5.6   

原文地址:https://www.cnblogs.com/fengfengyang/p/9858544.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!