首页 > 数据库 > MySQL > 正文

最全的mysql 5.7.13 安装配置方法图文教程(linux) 强烈推荐!

2024-07-24 13:10:16
字体:
来源:转载
供稿:网友

linux环境Mysql 5.7.13安装教程分享给大家,供大家参考,具体内容如下

1系统约定
安装文件下载目录:/data/software
Mysql目录安装位置:/usr/local/mysql
数据库保存位置:/data/mysql
日志保存位置:/data/log/mysql

2下载mysql
在官网:http://dev.mysql.com/downloads/mysql/ 中,选择以下版本的mysql下载:

mysql5.7.13,mysql5.7,linux

执行如下命名:
#mkdir /data/software
#cd /data/software
#wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz

3解压压缩包到目标位置
# mkdir /usr/local/mysql
#cd /dat/software
#pwd
执行后如下:

mysql5.7.13,mysql5.7,linux

#ls

mysql5.7.13,mysql5.7,linux

#cd /usr/local
#pwd

mysql5.7.13,mysql5.7,linux

# tar -xzvf /data/software/mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz

mysql5.7.13,mysql5.7,linux

#ls

mysql5.7.13,mysql5.7,linux

--修改文件名
# mv mysql-5.7.13-linux-glibc2.5-x86_64 mysql
#ls

mysql5.7.13,mysql5.7,linux

4创建数据仓库目录
--/data/mysql 数据仓库目录
# mkdir /data/mysql
#ls /data/

mysql5.7.13,mysql5.7,linux

5新建mysql用户、组及目录
# ---新建一个msyql组
# useradd -r -s /sbin/nologin -g mysql mysql -d /usr/local/mysql ---新建msyql用户禁止登录shell

6改变目录属有者
#cd /usr/local/mysql
#pwd
#chown –R mysql .
#chgrp –R mysql .

mysql5.7.13,mysql5.7,linux

#chown -R mysql /data/mysql

7配置参数
# bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql

mysql5.7.13,mysql5.7,linux

此处需要注意记录生成的临时密码,如上文:YLi>7ecpe;YP
#bin/mysql_ssl_rsa_setup --datadir=/data/mysql

mysql5.7.13,mysql5.7,linux

8修改系统配置文件

mysql5.7.13,mysql5.7,linux

# cp my-default.cnf /etc/my.cnf
# cp mysql.server /etc/init.d/mysql

mysql5.7.13,mysql5.7,linux

# vim /etc/init.d/mysql
修改以下内容:

mysql5.7.13,mysql5.7,linux

# vim /etc/my.cnf
修改以下内容:

mysql5.7.13,mysql5.7,linux

mysql5.7.13,mysql5.7,linux

mysql5.7.13,mysql5.7,linux

9启动mysql

mysql5.7.13,mysql5.7,linux

#bin/mysqld_safe --user=mysql &

mysql5.7.13,mysql5.7,linux

bin/mysql --user=root –p
--输入第6步生成的临时密码

mysql5.7.13,mysql5.7,linux

mysql5.7.13,mysql5.7,linux

mysql> set password=password('A123456');

mysql5.7.13,mysql5.7,linux

mysql>grant all privileges on *.* to root@'%' identified by 'A123456';
mysql> flush privileges;

mysql5.7.13,mysql5.7,linux

mysql> use mysql;
mysql> select host,user from user;

mysql5.7.13,mysql5.7,linux

10添加系统路径
# vim /etc/profile
添加:
export PATH=/usr/local/mysql/bin:$PATH
如下:

mysql5.7.13,mysql5.7,linux

# source /etc/profile

11配置mysql自动启动
# chmod 755 /etc/init.d/mysql
# chkconfig --add mysql
# chkconfig --level 345 mysql on

以上就是linux环境Mysql 5.7.13安装教程的第一套方案,希望对大家的学习有所帮助。

本文实例为大家分享了Linux mysql5.7.13安装教程,供大家参考,具体内容如下

1、准备
cmake-3.6.0.tar.gz
bison-3.0.4.tar.gz
mysql-5.7.13.tar.gz (http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13.tar.gz)

2、安装cmake 和 bison
首先可以查看下是否安装了 cmake

# rpm -qa |grep cmake # tar zxvf cmake-3.6.0.tar.gz# cd cmake-3.6.0# ./bootstrap# make && make install # tar zxvf bison-3.0.4.tar.gz# cd bison-3.0.4# ./configure# make && make install 

3、安装Mysql

[root@localhost src]# tar -zxvf mysql-5.7.13.tar.gz[root@localhost src]# cd mysql-5.7.13[root@localhost mysql-5.7.13]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=gbk -DDEFAULT_COLLATION=gbk_chinese_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/data/mysqldb -DMYSQL_TCP_PORT=3306 -DENABLE_DOWNLOADS=1 ...CMake Error at cmake/boost.cmake:81 (MESSAGE): You can download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<directory> This CMake script will look for boost in <directory>. If it is not there, it will download and unpack it (in that directory) for you. If you are inside a firewall, you may need to use an http proxy: export http_proxy=http://example.com:80Call Stack (most recent call first): cmake/boost.cmake:238 (COULD_NOT_FIND_BOOST) CMakeLists.txt:451 (INCLUDE)-- Configuring incomplete, errors occurred!

mysql5.7.13,mysql5.7,linux

注:重新运行配置,需要删除CMakeCache.txt文件
解决:
(1)在预编译时添加相应的选项:cmake -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost
(2)或者下载一个boost包,放到/usr/local/boost目录下,然后在cmake后面加选项-DWITH_BOOST=/usr/local/boost

[root@localhost mysql-5.7.13]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=gbk -DDEFAULT_COLLATION=gbk_chinese_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/data/mysqldb -DMYSQL_TCP_PORT=3306 -DENABLE_DOWNLOADS=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost ....  CMake Error at cmake/readline.cmake:64 (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:107 (FIND_CURSES) cmake/readline.cmake:181 (MYSQL_USE_BUNDLED_EDITLINE) CMakeLists.txt:479 (MYSQL_CHECK_EDITLINE) -- Configuring incomplete, errors occurred! See also "/usr/local/src/mysql-5.7.13/CMakeFiles/CMakeOutput.log". See also "/usr/local/src/mysql-5.7.13/CMakeFiles/CMakeError.log".

解决:
(1)安装ncurses-devel
yum -y install ncurses-devel
(2)删除CMakeCache.txt
rm CMakeCache.txt
(3)重新cmake

复制代码 代码如下:
[root@localhost mysql-5.7.13]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=mysql.mysql -DDEFAULT_CHARSET=gbk -DDEFAULT_COLLATION=gbk_chinese_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/data/mysqldb -DMYSQL_TCP_PORT=3306 -DENABLE_DOWNLOADS=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost

 

 

复制代码 代码如下:
[root@localhost mysql-5.7.13]# make[root@localhost mysql-5.7.13]# make install

 

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持VeVb武林网。


注:相关教程知识阅读请移步到MYSQL教程频道。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表