服务器之家

服务器之家 > 正文

Mysql 5.6.24安装实例教程

时间:2020-07-05 16:11     来源/作者:鹰之蜕变

安装前准备工作:

1)编辑PATH路径

?
1
2
3
vim /etc/profile
PATH=/home/mysql/bin:/home/mysql/lib:$PATH
export PATH

2)生效PATH

?
1
source /etc/profile

3)编辑hosts

?
1
2
vim /etc/hosts
192.168.117.130 cc-test

安装

1.环境配置

?
1
yum install - y gcc gcc-c++ make cmake

2.准备好安装包mysql-5.6.24.tar.gz,并将它拷贝到/home目录下

rz

3.解压安装包并更名

?
1
2
tar -zxvf mysql-5.6.2.tar.gz
mv mysql-5.6.2.tar.gz mysql

 

4.新增用户组 及用户

?
1
2
groupadd mysql
useradd mysql -g mysql

5.创建data

?
1
mkdir /home/mysql/data

6.编译mysql

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
cmake \
-DCMAKE_INSTALL_PREFIX=/home/mysql \
-DMYSQL_UNIX_ADDR=/home/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/home/mysql/data \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3306

7.安装

?
1
2
make install
make clean

8.修改目录拥有者

?
1
2
chown -R mysql:mysql /home/mysql
chown -R mysql:mysql /home/mysql/data

9.初始化配置脚本

?
1
scripts /mysql-install-db --user=nysql --datadir=/home/mysql/data

10.重新更改权限

?
1
chown -R mysql:mysql /home/mysql

11.复制服务器启动脚本

?
1
2
3
cp /home/mysql/support-files/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql
cp /home/mysql/support-files/my-default.cnf /etc/my.cnf

12.启动

?
1
service mysqld start

13.netstat -anp 查看端口是否监听上

14.进入mysql

?
1
2
cd /mysql/bin
./mysql -u root -p

问题1:

?
1
[root@cc-test mysql]# cmake .

出现以下错误提示:

?
1
2
3
4
5
6
7
8
9
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:82 (MESSAGE):
Curses library not found. Please install appropriate package,
remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.
Call Stack (most recent call first):
cmake/readline.cmake:126 (FIND_CURSES)
cmake/readline.cmake:216 (MYSQL_USE_BUNDLED_LIBEDIT)
CMakeLists.txt:250 (MYSQL_CHECK_READLINE)
-- Configuring incomplete, errors occurred!

解决方法:

?
1
2
3
4
5
6
7
8
9
[root@cc-test mysql]# rm CMakeCache.txt
[root@cc-test mysql]# yum install ncurses-devel
Warning: Bison executable not found in PATH
-- Configuring done
-- Generating done
-- Build files have been written to: /software/mysql-5.5.11
[root@cc-test mysql]# yum install bison
[root@cc-test mysql]# cmake ……
[root@cc-test mysql]# make install

问题2:

?
1
2
[root@cc-test mysql]# scripts/mysql_install_db --user=mysql --datadir=/home/mysql/data
-bash: scripts/mysql_install_db: Permission denied

解决方法:

?
1
[root@cc-test mysql]# chmod 755 scripts/mysql_install_db

问题3:

?
1
service mysqld start 启动时发生 PID错误

解决方法:

?
1
2
3
4
5
chown -R mysql.mysql
su - mysql
-bash-4.1$ (ctrl+d)
scripts /mysql.install_db/home/mysql/bin/mysql_safe --user=mysql&/etc/rc.d/init.d/mysqld status
/etc/rc.d/init.d/mysqld start

以上所述是小编给大家介绍的Mysql 5.6.24安装实例教程,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对服务器之家网站的支持!

原文链接:http://www.cnblogs.com/cc-Study/archive/2016/12/11/6160252.html

相关文章

热门资讯

2020微信伤感网名听哭了 让对方看到心疼的伤感网名大全
2020微信伤感网名听哭了 让对方看到心疼的伤感网名大全 2019-12-26
歪歪漫画vip账号共享2020_yy漫画免费账号密码共享
歪歪漫画vip账号共享2020_yy漫画免费账号密码共享 2020-04-07
沙雕群名称大全2019精选 今年最火的微信群名沙雕有创意
沙雕群名称大全2019精选 今年最火的微信群名沙雕有创意 2019-07-07
男生常说24816是什么意思?女生说13579是什么意思?
男生常说24816是什么意思?女生说13579是什么意思? 2019-09-17
玄元剑仙肉身有什么用 玄元剑仙肉身境界等级划分
玄元剑仙肉身有什么用 玄元剑仙肉身境界等级划分 2019-06-21
返回顶部