002. Centos7安装mysql5.5.37
- 下载cmake-2.8.12.2.tar.gz, 下载地址: https://pan.baidu.com/s/1qYtpX7m
- 下载mysql-5.5.37.tar.gz, 下载地址: http://pan.baidu.com/s/1miFcNP2
- 下载ncurses-5.9.tar.gz, 下载地址: http://pan.baidu.com/s/1kVDIXW7
(百度网盘的连接地址使用wget下载不了)
4. 将上面三个包, 传到服务器上, 并解压
[root@iZ25bdzgev8Z mysql-5.5.37]# tar xvf mysql-5.5.37.tar.gz
5. 进入cmake-2.8.12.2目录(如有报错请看文末)
[root@iZ25bdzgev8Z cmake-2.8.12.2]# ./configure
[root@iZ25bdzgev8Z cmake-2.8.12.2]# make && make install
6. 进入mysql-5.5.37目录
[root@iZ25bdzgev8Z ~]# cd mysql-5.5.37
[root@iZ25bdzgev8Z mysql-5.5.37]# cmake ./ (如有报错请看文末)
7. 解决完上面的报错后, 继续执行(如果没有报错, 此步骤可直接跳过)
[root@iZ25bdzgev8Z ncurses-5.9]# cd ..
[root@iZ25bdzgev8Z ~]# cd mysql-5.5.37
[root@iZ25bdzgev8Z mysql-5.5.37]#
[root@iZ25bdzgev8Z mysql-5.5.37]# rm -f CMakeCache.txt
因为刚才没有编译成功, 所以需要删除刚才编译生成的CmakeCache.txt文件, 否则过不去的, 然后重新cmake ./
[root@iZ25bdzgev8Z mysql-5.5.37]# cmake ./
8.开始安装, mysql默认将成功安装到/usr/local/mysql
[root@iZ25bdzgev8Z mysql-5.5.37]# make && make install
9. 在它安装的过程中创建一个mysql用户和mysql组
[root@iZ25bdzgev8Z ~]# groupadd mysql
[root@iZ25bdzgev8Z ~]# useradd -r -g mysql mysql
[root@iZ25bdzgev8Z ~]# chown -R mysql.mysql /usr/local/mysql
这个目录,如果没有安装成功, 是不可以操作/usr/local/mysql目录的
10. 启动mysql
[root@iZ25bdzgev8Z ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql
11. 注册mysql服务, 设置开机自动启动
复制配置文件到etc下:
[root@iZ25bdzgev8Z ~]# cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
复制mysql启动文件到init.d目录下, 并命名为mysql
[root@iZ25bdzgev8Z ~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
[root@iZ25bdzgev8Z ~]# chmod +x /etc/init.d/mysql
[root@iZ25bdzgev8Z ~]# /sbin/chkconfig --add mysql
添加系统变量:
[root@iZ25bdzgev8Z ~]# vi /etc/profile #修改profile文件, 下次重启也能生效
export PATH=$PATH:/usr/local/mysql/bin # 在配置文件中加入此行配置
[root@iZ25bdzgev8Z ~]# source /etc/profile
修改 .bashrc 文件使在当前用户 shell 下生效
# vi /root/.bashrc
在里面加入:
export
PATH=$PATH:/usr/local/mysql/bin
修改这个文件之后同样也需要使用 source使配置文件生效.
启动mysql服务:
[root@iZ25bdzgev8Z
~]# service mysql start (可能会报错了)
Starting
MySQL...The server quit without updating PID file [FAILED]cal/mysql/data/iZ25bdzgev8Z.pid).
//重新启动服务
[root@iZ25bdzgev8Z
~]# /usr/local/mysql/scripts/mysql_install_db --user=mysql
--basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
Installing MySQL system tables...
尝试连接:
[root@iZ25bdzgev8Z ~]# /usr/local/mysql/bin/mysql -u root
-p
12. 登录mysql
[root@iZ25bdzgev8Z
~]# /usr/local/mysql/bin/mysql -u root -p
Enter
password:
ERROR
2002 (HY000): Can't connect to local MySQL server through socket
'/tmp/mysql.sock' (2) #没有mysql.sock文件
[root@iZ25bdzgev8Z
/]# killall mysqld
[root@iZ25bdzgev8Z
/]# killall mysql #杀死所有和mysql相关的进程
[root@iZ25bdzgev8Z
~]# ls /tmp/mysql
ls: cannot
access /tmp/mysql: No such file or directory
[root@iZ25bdzgev8Z
~]# find / -name mysql.sock #找一找
/var/lib/mysql/mysql.sock
修改my.cnf配置文件, 后重启mysql, 然后重新登录即可
[root@iZ25bdzgev8Z ~]# vi /etc/my.cnf
[client]
#password =
your_password
port = 3306
#socket
= /tmp/mysql.sock
socket
= /var/lib/mysql/mysql.sock #如果这个不行, 还需要将上面一行给解开注释. . .
[root@iZ25bdzgev8Z
/]# netstat -tnulp | grep 3306 #过滤下3306, 此时应该没有任何信息
[root@iZ25bdzgev8Z
/]# /etc/rc.d/init.d/mysql start
Starting MySQL..
[ OK ]
#此时再过滤3306应该有数据了
13. 使用mysql登录吧
[root@iZ25bdzgev8Z /]# mysql
Welcome to the MariaDB
monitor. Commands end with ; or \g.
Your MySQL connection id
is 1
Server version: 5.5.37-log
Source distribution
Copyright (c) 2000, 2016,
Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for
help. Type '\c' to clear the current input statement.
MySQL [(none)]> exit
Bye
错误及其解决方案:
1. 在安装cmake执行到, make时候报出以下错误:
e: *** No targets specified and no makefile
found. Stop.
解决方案:
这是没有安装编译环境所致, 联网安装gcc
yum install gcc gcc-c++ autoconf automake
2. 安装mysql 5.5.37时候的错误提示:
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:127 (FIND_CURSES)
cmake/readline.cmake:217
(MYSQL_USE_BUNDLED_LIBEDIT)
CMakeLists.txt:355 (MYSQL_CHECK_READLINE)
ncurses是字符终端下屏幕控制的基本库,很多新开发的程序已经不再使用,但要编译一些老的程序,还是会经常碰到,解决这个问题就是安装一下Curses即可
[root@iZ25bdzgev8Z ~]# tar xvf
ncurses-5.9.tar.gz
[root@iZ25bdzgev8Z ~]# cd ncurses-5.9
[root@iZ25bdzgev8Z ncurses-5.9]#
./configure && make && make install
3. 登录错误故障解决:
[root@iZ25bdzgev8Z ~]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@iZ25bdzgev8Z ~]# netstat -ano | grep 3306 #
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN off (0.00/0/0)
[root@iZ25bdzgev8Z ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.37-log Source distribution
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [(none)]> use mysql;
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'
#因为mysql数据库的user表里,存在用户名为空的账户即匿名账户,导致登录的时候是虽然用的是root,但实际是匿名登录的
MySQL [(none)]> exit
Bye
解决方案:
[root@iZ25bdzgev8Z ~]# service mysql stop #停止msyql
Shutting down MySQL. [ OK ]
[root@iZ25bdzgev8Z ~]# mysqld_safe --skip-grant-table
161228 09:23:52 mysqld_safe Logging to '/var/lib/mysql/iZ25bdzgev8Z.err'.
161228 09:23:52 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
#新开一个连接
[root@iZ25bdzgev8Z ~]# mysql -u root mysql
. . .
MariaDB [mysql]> delete from user where USER='';
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> show databases;
. . .
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> show databases;
. . .
MariaDB [(none)]> use mysql;
Database changed
MariaDB [mysql]> select host , user,password from user;
+-----------+------+-------------------------------------------+
| host | user | password |
+-----------+------+-------------------------------------------+
| localhost | root | *C722458C25A26EA653682196537D713A5AE439F8 |
| 127.0.0.1 | root | *C722458C25A26EA653682196537D713A5AE439F8 |
| ::1 | root | *C722458C25A26EA653682196537D713A5AE439F8 |
+-----------+------+-------------------------------------------+
3 rows in set (0.00 sec)
002. Centos7安装mysql5.5.37的更多相关文章
- Centos7 安装 MySQL5.7
Centos7 安装 MySQL5.7 一.环境介绍 1.安装包版本介绍 MySQL 有三种安装方式:RPM安装.二进制包安装.源码包安装.我们这篇文章以二进制方式安装MySQL 软件名称 版本 系统 ...
- CentOS 6.9上安装mysql-5.6.37
CentOS 6.9上安装mysql-5.6.37 1.准备数据存放的文件系统 新建一个逻辑卷,并将其挂载至特定目录即可.这里不再给出过程. 这里假设其逻辑卷的挂载目录为/data,而后需要创建/da ...
- centos7安装mysql5.7.19及配置远程连接
centos7安装mysql5.7.19及配置远程连接------https://blog.csdn.net/Lh19931122/article/details/77996213
- Linux学习第三步(Centos7安装mysql5.7数据库)
版本:mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar 前言:在linux下安装mysql不如windows下面那么简单,但是也不是很难.本文向大家讲解了如何在Cent ...
- Centos7安装mysql-5.7.19
Centos7安装Mysql 一 mysql下载 地址: https://dev.mysql.com/downloads/mysql/#downloads 二 在centos7上创建安装文件存放.解压 ...
- Centos7安装Mysql5.7方法总结 - 实操手册
Centos7.x版本下针对Mysql的安装和使用多少跟之前的Centos6之前版本有所不同的,废话就不多赘述了,下面介绍下在centos7.x环境里安装mysql5.7的几种方法:一.yum方式安装 ...
- centos7安装mysql5.7修改设置密码策略
centos7操作系统在安装mysql5.7社区版之后会有默认密码,通过grep命令在mysqld.log文件中即可找到,如下所示: 标识位置即在初始化安装时mysql的默认密码,然后通过mysql ...
- centos7安装MySQL5.7无法设置密码问题
前言 在使用centos7系统yum方式安装MySQL5.7后 不知道默认密码是多少 知道后没办法修改? 一.找到MySQL密码 service mysqld start vim /var/log/ ...
- CentOS7安装MySQL5.7以及修改密码
CentOS7安装mysql [root@bd005 ~]# wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch. ...
随机推荐
- opencv+vs2010
当程序的输出是系统而不是vs2010时 可以使用Ctrl+F5运行 或者使用命令行模式 打开cmd.exe窗口 输入自己工程(项目)所在的盘,比如我放在E盘的,我就输入E:,按回车 输入cd, ...
- 《C++primer》v5 第6章 函数 读书笔记 习题答案
6.1 实参是在函数调用处填写的参数.形参是在函数体使用的参数. 实参是形参的初始值. 具体参见:http://blog.163.com/zhengguo_li/blog/static/7030148 ...
- jQuery Ajax MVC 下拉框联动
无刷新下拉框联动方法: Controllers代码 public JsonResult DH_Change(string DH_ID) { List<SelectListItem> Tea ...
- android studio 2.2.2下fragment的创建和跳转
一,首先,Fragment是android应用中十分重要的一个功能,十分轻量化,也类似于activity一样,是一个个布局,可以相互跳转和传递参数.但是,它运行起来十分流畅,而且易于管理,下面是在学习 ...
- 0526 Sprint1个人总结 & 《构建之法》第八、九、十章
Sprint1的个人总结: 我是老人组的成员,我们是做一款四则运算训练的软件.然后我是接了界面设计的任务,所以我任务将会是sprint1中相对重一点的一方.我的感觉是,界面要做得充满童趣,毕竟我们的软 ...
- 基于HTML5的网络拓扑图
电信网管系统中,设备状态信息的实时展示非常重要,通常会挂载一堆图标来展示状态或告警信息,图标的信息量有限,有时需要更详细的面板,甚至以图表的形式展现,本文将结合最近客户提到的需求,使用 Qunee1. ...
- 一些初级Java错误,不定期增加
1. Error: Dangling meta character '*' near index 0 对字符串使用split()方法截取 * ? + / | 等字符的时候会报以下异常 Dangling ...
- snoopy采集
Snoopy是一个php类,用来模拟浏览器的功能,可以获取网页内容,发送表单.Snoopy正确运行需要你的服务器的PHP版本在4以上,并且支持PCRE(Perl Compatible Regular ...
- GridView导出excel格式问题
在导出的点击事件中,代码如下: //指定导出对应单元格为文本样式 string style = @"<style> .test { vnd.ms-excel.numberform ...
- What is the difference between the ways to implement inheritance in javascript.
see also : http://www.w3school.com.cn/js/pro_js_inheritance_implementing.asp http://davidshariff.com ...