欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Mysql 5.6.24安装实例教程

程序员文章站 2023-12-17 09:00:10
安装前准备工作: 1)编辑path路径 vim /etc/profile path=/home/mysql/bin:/home/mysql/lib:$path...

安装前准备工作:

1)编辑path路径

vim /etc/profile
path=/home/mysql/bin:/home/mysql/lib:$path
export path

2)生效path

source /etc/profile

3)编辑hosts

vim /etc/hosts
192.168.117.130 cc-test

安装

1.环境配置

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

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

rz

3.解压安装包并更名

tar -zxvf mysql-5.6.2.tar.gz
mv mysql-5.6.2.tar.gz mysql

4.新增用户组 及用户

groupadd mysql
useradd mysql -g mysql

5.创建data

mkdir /home/mysql/data

6.编译mysql

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.安装

make install
make clean

8.修改目录拥有者

chown -r mysql:mysql /home/mysql
chown -r mysql:mysql /home/mysql/data

9.初始化配置脚本

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

10.重新更改权限

chown -r mysql:mysql /home/mysql

11.复制服务器启动脚本

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.启动

service mysqld start

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

14.进入mysql

cd /mysql/bin
./mysql -u root -p

问题1:

[root@cc-test mysql]# cmake .

出现以下错误提示:

-- 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!

解决方法:

[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:

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

解决方法:

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

问题3:

service mysqld start 启动时发生 pid错误

解决方法:

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安装实例教程,希望对大家有所帮助

上一篇:

下一篇: