- ubuntu12.04环境下使用kvm ioctl接口实现最简单的虚拟机
- Ubuntu 通过无线网络安装Ubuntu Server启动系统后连接无线网络的方法
- 在Ubuntu上搭建网桥的方法
- ubuntu 虚拟机上网方式及相关配置详解
CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.
这篇CFSDN的博客文章CentOS安装MySQL5.5的完整步骤由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.
由于centos7自带的是 mariadb, 所以先来删除他吧… 。
查找版本 。
1
|
# rpm -qa|grep mariadb
|
执行命令后会出现类似 mariadb-server-5.5.49-1.el7.centos.x86_64 之类的鬼…记住名字就行了… 。
删除 。
1
|
# rpm -e
--nodeps 上面查出来的文件名
|
删除配置文件 。
1
|
# rm /etc/my.cnf
|
到这里就ok了…现在我们开始安装mysql 。
下载地址 https://downloads.mysql.com/archives/community/ 。
上传 。
1
2
3
4
|
[root@bogon /]# cd /tmp
[root@bogon tmp]# rz #然后选择安装包上传到centos
[root@bogon tmp]# ll
-rw-r
--r--. 1 root root 198993245 11月 6 12:35 mysql-5.5.62-linux-glibc2.12-x86_64.tar.gz
|
解压 。
1
2
3
4
|
[root@bogon tmp]# tar -zxvf mysql-5.5.62-linux-glibc2.12-x86_64.tar.gz
[root@bogon tmp]# ll
drwxr-xr-x. 13 root root 213 11月 6 12:41 mysql-5.5.62-linux-glibc2.12-x86_64
-rw-r
--r--. 1 root root 198993245 11月 6 12:35 mysql-5.5.62-linux-glibc2.12-x86_64.tar.gz
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
[root@bogon tmp]# mv mysql-5.5.62-linux-glibc2.12-x86_64 /usr/
local
/
[root@bogon tmp]# cd /usr/
local
/
[root@bogon
local
]# ll
总用量 0
drwxr-xr-x. 2 root root 6 5月 11 2019 bin
drwxr-xr-x. 2 root root 6 5月 11 2019 etc
drwxr-xr-x. 2 root root 6 5月 11 2019 games
drwxr-xr-x. 2 root root 6 5月 11 2019 include
drwxr-xr-x. 2 root root 6 5月 11 2019 lib
drwxr-xr-x. 2 root root 6 5月 11 2019 lib64
drwxr-xr-x. 2 root root 6 5月 11 2019 libexec
drwxr-xr-x. 13 root root 213 11月 6 12:41 mysql-5.5.62-linux-glibc2.12-x86_64
drwxr-xr-x. 2 root root 6 5月 11 2019 sbin
drwxr-xr-x. 5 root root 49 8月 23 10:42 share
drwxr-xr-x. 2 root root 6 5月 11 2019 src
[root@bogon
local
]# mv mysql-5.5.62-linux-glibc2.12-x86_64 mysql-5.5.60
[root@bogon
local
]# ll
总用量 0
drwxr-xr-x. 2 root root 6 5月 11 2019 bin
drwxr-xr-x. 2 root root 6 5月 11 2019 etc
drwxr-xr-x. 2 root root 6 5月 11 2019 games
drwxr-xr-x. 2 root root 6 5月 11 2019 include
drwxr-xr-x. 2 root root 6 5月 11 2019 lib
drwxr-xr-x. 2 root root 6 5月 11 2019 lib64
drwxr-xr-x. 2 root root 6 5月 11 2019 libexec
drwxr-xr-x. 13 root root 213 11月 6 12:41 mysql-5.5.60
drwxr-xr-x. 2 root root 6 5月 11 2019 sbin
drwxr-xr-x. 5 root root 49 8月 23 10:42 share
drwxr-xr-x. 2 root root 6 5月 11 2019 src
|
1
|
[root@bogon
local
]# vi /etc/my.cnf
|
将一下内容复制到新文件中 。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
[mysql]
# 设置mysql客户端默认字符集
default
-
character
-
set
=utf8
socket=/var/lib/mysql/mysql.sock
[mysqld]
skip-
name
-resolve
#设置3306端口
port = 3306
socket=/var/lib/mysql/mysql.sock
# 设置mysql的安装目录, 这里的目录一定要是你解压后并且改了名的目录哟..
basedir=/usr/
local
/mysql-5.5.60
# 设置mysql数据库的数据的存放目录, 这里的目录一定要是你解压后并且改了名的目录哟..
datadir=/usr/
local
/mysql-5.5.60/data
# 允许最大连接数
max_connections=200
# 服务端使用的字符集默认为8比特编码的latin1字符集
character
-
set
-server=utf8
# 创建新表时将使用的默认存储引擎
default
-storage-engine=innodb
lower_case_table_name=1
max_allowed_packet=16m
|
配置命令:
1
2
3
4
|
# cd /usr/
local
/mysql-5.5.60
# groupadd mysql
# useradd -g mysql mysql
# chown -r mysql:mysql ./
|
安装命令:
1
|
./scripts/mysql_install_db
--user=mysql --basedir=/usr/local/mysql-5.5.60/ --datadir=/usr/local/mysql-5.5.60/data/
|
演示:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
[root@bogon
local
]# cd mysql-5.5.60/
[root@bogon mysql-5.5.60]#
[root@bogon mysql-5.5.60]# groupadd mysql
groupadd:“mysql”组已存在
[root@bogon mysql-5.5.60]# useradd -g mysql mysql
useradd:用户“mysql”已存在
[root@bogon mysql-5.5.60]# chown -r mysql:mysql ./
[root@bogon mysql-5.5.60]# ./scripts/mysql_install_db
--user=mysql --basedir=/usr/local/mysql-5.5.60/ --datadir=/usr/local/mysql-5.5.60/data/
installing mysql system tables...
....
....
please report
any
problems
at
http://bugs.mysql.com/
[root@bogon mysql-5.5.60]# chown -r mysql:mysql data
[root@bogon mysql-5.5.60]# chown 777 /etc/my.cnf
[root@bogon mysql-5.5.60]# ll
总用量 56
drwxr-xr-x. 2 mysql mysql 4096 11月 6 12:41 bin
-rw-r
--r--. 1 mysql mysql 17987 8月 29 2018 copying
drwxr-xr-x. 5 mysql mysql 57 11月 6 12:48 data
drwxr-xr-x. 2 mysql mysql 55 11月 6 12:41 docs
drwxr-xr-x. 3 mysql mysql 4096 11月 6 12:41 include
-rw-r
--r--. 1 mysql mysql 301 8月 29 2018 install-binary
drwxr-xr-x. 3 mysql mysql 4096 11月 6 12:41 lib
drwxr-xr-x. 4 mysql mysql 30 11月 6 12:41 man
drwxr-xr-x. 10 mysql mysql 4096 11月 6 12:41 mysql-test
-rw-r
--r--. 1 mysql mysql 2496 8月 29 2018 readme
drwxr-xr-x. 2 mysql mysql 30 11月 6 12:41 scripts
drwxr-xr-x. 27 mysql mysql 4096 11月 6 12:41 share
drwxr-xr-x. 4 mysql mysql 4096 11月 6 12:41 sql-bench
drwxr-xr-x. 2 mysql mysql 4096 11月 6 12:41 support-files
[root@bogon mysql-5.5.60]# cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
[root@bogon mysql-5.5.60]# chmod +x /etc/rc.d/init.d/mysqld
[root@bogon mysql-5.5.60]# chkconfig
--add mysqld
[root@bogon mysql-5.5.60]# chkconfig
--list mysqld
注:该输出结果只显示 sysv 服务,并不包含
原生 systemd 服务。sysv 配置数据
可能被原生 systemd 配置覆盖。
要列出 systemd 服务,请执行
'systemctl list-unit-files'
。
查看在具体 target 启用的服务请执行
'systemctl list-dependencies [target]'
。
mysqld 0:关 1:关 2:开 3:开 4:开 5:开 6:关
|
1
2
3
4
5
6
|
# chown -r mysql:mysql data
# chown 777 /etc.my.cnf
# cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
# chmod +x /etc/rc.d/init.d/mysqld
# chkconfig
--add mysqld
# chkconfig
--list mysqld
|
chmod 和 chown的区别 。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
chown 修改文件和文件夹的用户和用户组属性
(1)要修改文件hh.c的所有者.修改为sakia的这个用户所有
chown sakia hh.c #这样就把hh.c的用户访问权限应用到sakia作为所有者
(2)将目录 /tmp/sco 这个目录的所有者和组改为sakia和组net
chown -r sakia:net /tmp/sco
chmod 修改文件和文件夹读写执行属性
(1)把hh.c文件修改为可写可读可执行
chmod 777 hh.c
(2)要修改某目录下所有的文件属性为可写可读可执行
chmod 777 *.* #把文件夹名称与后缀名用*来代替就可以了。
(3)同理若是要修改所有htm文件的属性
chmod 777 *.htm
(4)把目录 /tmp/sco修改为可写可读可执行
chmod 777 /tmp/sco
(5)要修改某目录下所有的文件夹属性为可写可读可执行
chmod 777 * #把文件夹名称用*来代替就可以了
(6)要修改/tmp/sco下所有的文件和文件夹及其子文件夹属性为可写可读可执行
chmod -r 777 /tmp/sco
##
可写 w=4
可读 r=2
可执行 x=1
777就是拥有全权限,根据需要可以自由组合用户和组的
##
|
1
|
[root@bogon mysql-5.5.60]# service mysqld start
|
一旦报错 。
1
2
3
4
|
[root@bogon mysql-5.5.60]# service mysqld start
starting mysql.logging
to
'/usr/local/mysql-5.5.60/data/bogon.err'
.
201106 12:50:02 mysqld_safe directory
'/var/lib/mysql'
for
unix socket file don't exists.
error! the server quit without updating pid file (/usr/
local
/mysql-5.5.60/data/bogon.pid).
|
解决方法 。
1
2
3
4
5
6
|
随即执行命令:cat /usr/
local
/mysql/data/iz2ze8hspx8qsmxx7b1i9sz.err查看错误原因
error内容如下:
[error] can't start server : bind
on
unix socket: permission denied
[error] do you already have another mysqld server running
on
socket: /var/lib/mysql/mysql.sock ?
结合先前写入配置/etc/my.cnf:
|
由上不难理解—— 。
第一:
mysqld_safe directory ‘/var/lib/mysql' for unix socket file don't exists. “var/lib/mysql”目录不存在,首要先创建:
mkdir /var/lib/mysql 第二:
mysql客户端和服务器端是通过初始化mysql.sock 文件来进行通信,所以服务器在启动时需要写入该文件,因此该文件所存放的目录必须双方都 。
具有访问权限。而异常日志中表示:
[error] can't start server : bind on unix socket: permission denied 。
所以,mysql服务不具备目录 /var/lib/mysql 的写入权限,无法生成mysql.sock文件,自然服务启动时无法找到该文件.
给目录 /var/lib/mysql 付予写入权限或者最大权限—chmod 777 /var/lib/mysql 。
1
2
|
[root@bogon lib]# mkdir mysql
[root@bogon lib]# chmod 777 -r mysql/
|
最终:
1
2
|
[root@bogon lib]# service mysql start
starting mysql... success!
|
配置path 。
1
|
# vi ~/.bash_profile
|
在文件最后面加入以下内容,并使用:wq保存 。
1
|
export path=$path:/usr/
local
/mysql-5.5.60/bin
|
刷新path 。
1
|
# source ~/.bash_profile
|
1
|
[root@bogon lib]# mysql -uroot -p
|
1
2
|
[root@bogon lib]# mysql -uroot -p
mysql: error while loading shared libraries: libncurses.so.5: cannot
open
shared object file:
no
such file
or
directory
|
系统是redhad8,binary方式安装完mysql之后,mysql命令登录不成功,报错:mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file: no such file or directory。按照百度的方法都不成功,应该和系统版本有关,后来自己想到一个方法:yum install libncurses*,完美解决问题.
解决
1
|
[root@bogon lib]# yum -y install libncurses*
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
[root@bogon lib]# mysql -uroot -p
enter
password
: #直接回车登录
welcome
to
the mysql monitor. commands
end
with
;
or
\g.
your mysql
connection
id
is
2
server version: 5.5.62 mysql community server (gpl)
copyright (c) 2000, 2018, oracle
and
/
or
its affiliates.
all
rights reserved.
oracle
is
a registered trademark
of
oracle corporation
and
/
or
its
affiliates. other names may be trademarks
of
their respective
owners.
type
'help;'
or
'\h'
for
help. type
'\c'
to
clear the
current
input statement.
mysql>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
mysql> use mysql;
reading
table
information
for
completion
of
table
and
column
names
you can turn
off
this feature
to
get a quicker startup
with
-a
database
changed
mysql>
update
user
set
password
=
password
(
'需要设置的密码'
)
where
user
=
'root'
and
host=
'localhost'
;
query ok, 1 row affected (0.00 sec)
rows
matched: 1 changed: 1 warnings: 0
mysql>
update
user
set
password
=
password
(
'12345'
)
where
user
=
'root'
and
host=
'localhost'
;
query ok, 1 row affected (0.00 sec)
rows
matched: 1 changed: 1 warnings: 0
mysql> flush
privileges
;
query ok, 0
rows
affected (0.00 sec)
|
1
2
3
4
5
|
mysql>
grant
all
privileges
on
*.*
to
'root'
@
'%'
identified
by
'12345'
with
grant
option
;
query ok, 0
rows
affected (0.00 sec)
mysql> flush
privileges
;
query ok, 0
rows
affected (0.00 sec)
|
如果远程无法登录则关闭防火墙 。
[root@bogon lib]# systemctl stop firewalld.service 。
到此这篇关于centos安装mysql5.5的文章就介绍到这了,更多相关centos安装mysql5.5内容请搜索我以前的文章或继续浏览下面的相关文章希望大家以后多多支持我! 。
原文链接:https://blog.csdn.net/Mr_YanMingXin/article/details/110858348 。
最后此篇关于CentOS安装MySQL5.5的完整步骤的文章就讲到这里了,如果你想了解更多关于CentOS安装MySQL5.5的完整步骤的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。
我正在使用 CentOS 6 机器。我尝试遵循以下指南: How to open port in centOS http://ask.xmodulo.com/open-port-firewall-ce
我正在为 CentOS 7 创建一个脚本,但我正在努力根据变量连接值,这与我工作的其他发行版不同。例如,在下面的代码中: DIR_BKP=/tmp/_bkp_local PATH_LOG=$DIR_B
我从以下位置下载了文件: https://github.com/christiangalsterer/httpbeat/releaseshttpbeat-4.0.0-x86_64.rpm 并尝试通过以
我想在我的 Centos 8 中使用命令 mkimage。 我尝试使用命令 dnf install uboot-tools 以 root 身份安装 uboot-tools 但这不可用。 谁能指导我如何
我有一个 Centos 服务器。 结果 $ cat /etc/centos-release CentOS Linux release 7.9.2009 (Core) 和 $ yum list i
我在CentOs7 上安装Gitlab 后遇到了麻烦。我第一次被重定向到管理员密码创建页面,在输入管理员用户密码后,服务器发送错误。 422 The change you requested was
因此,我正在尝试从我的一个运行 centos 的邮箱中发送电子邮件,并且我已经安装并打开了 sendmail,但是发送一封电子邮件实际上需要几分钟时间。电子邮件不是应该几乎是即时的吗? 这是我的/et
我正在尝试在虚拟 Centos 7 发行版上构建一些 C++ 库。由于我还没有发现这个操作系统看不到/usr/local/lib 或/usr/local/lib64 的原因,这些库安装在其他 linu
我正在尝试通过以下网址在我的服务器(centos 7.1 minimal)上安装 imagemagick: imagemagick installation steps 在第 1 步得到这个错误: L
当我尝试安装 rpmforge(我需要安装 phpmyadmin)时出现此错误,将不胜感激任何帮助! [root@plasticarmy ~]# yum http://pkgs.repoforge.o
我需要安装一个centos 5 repo 来在centos 7 机器上下载用于el5 的dhclient,以便在centos 5 机器上传输dhclient rpms。有可能的 ? 谢谢! 最佳答案
我正在开发一个可以在 CentOS 8 和 CentOS 7 系统上运行的程序。在其中,我使用 gethostbyname 将 DNS 名称解析为 IP 地址。 为了尝试使代码可移植,我正在使用以下命
我想在 CentOS7(或 CentOS6)上安装 cgal 模块。它需要 pgrouting 才能使用 PostGIS。 我一直用 CGAL Manual Installation 安装 cgal
我在 CentOS 平台上使用 R/RStudio。我需要查看二进制日志文件(/var/log/messages)是否包含有关图形设备绘图问题的更多信息,但我无法从 RStudio 中读取它。 我在社
我正在尝试在我的 CentOS 上本地安装 Kubernetes。我正在关注这个博客 http://containertutorials.com/get_started_kubernetes/inde
来自 http://kubernetes.io/docs/getting-started-guides/kubeadm/ CentOS Linux 版本 7.2.1511(核心) (1/4) 在主机上
使用tcpdump监控网络流量时,发现很多dns反向查询记录。 像这样: A_IP.55276 > DNS_IP.domain: 9247+ PTR?查询 IP.in-addr.arpa。 (45)
我正在尝试在 CentOS 6.7 和 ./configure --prefix=$HOME/local 上安装 mutt运行良好,但在 make install步骤,我在下面遇到了这个错误,我不知道
如何在 CENTOS 中删除所有以 *0x0.jpg 结尾的文件?我需要删除嵌套在文件夹和子文件夹中的多个文件 最佳答案 我假设你有一个外壳 - 试试 find /mydirectory -type
我需要检索安装在我的 Linux (Centos) 主机上的所有软件包的软件包版本。 rpm -qa 给了我所有已安装软件包的列表。 我知道 rpm -qi "package name"给了我包信息。
我是一名优秀的程序员,十分优秀!