率先大家经过命令yum list | grep mysql看看MySQL是不是被装置过

CentOS6.4 安装MySQL,centos6.4安装mysql

首先大家通过命令yum list | grep mysql看看MySQL是或不是被装置过

[[email protected] /]# yum list | grep mysql

下一场通过yum的主意来拓展mysql的数据库安装,首先我们得以输入 yum list |
grep mysql 命令来查阅。

yum上提供的mysql数据库可下载的版本音信

mysql-libs.x86_64                          5.1.73-7.el6                 @base   
apr-util-mysql.x86_64                      1.3.9-3.el6_0.1              base    
bacula-director-mysql.x86_64               5.0.0-13.el6                 base    
bacula-storage-mysql.x86_64                5.0.0-13.el6                 base    
dovecot-mysql.x86_64                       1:2.0.9-22.el6               base    
freeradius-mysql.x86_64                    2.2.6-6.el6_7                base    
libdbi-dbd-mysql.x86_64                    0.8.3-5.1.el6                base    
mod_auth_mysql.x86_64                      1:3.0.0-11.el6_0.1           base    
mysql.x86_64                               5.1.73-8.el6_8               base    
mysql-bench.x86_64                         5.1.73-8.el6_8               base    
mysql-connector-java.noarch                1:5.1.17-6.el6               base    
mysql-connector-odbc.x86_64                5.1.5r1144-7.el6             base    
mysql-devel.i686                           5.1.73-8.el6_8               base    
mysql-devel.x86_64                         5.1.73-8.el6_8               base    
mysql-embedded.i686                        5.1.73-8.el6_8               base    
mysql-embedded.x86_64                      5.1.73-8.el6_8               base    
mysql-embedded-devel.i686                  5.1.73-8.el6_8               base    
mysql-embedded-devel.x86_64                5.1.73-8.el6_8               base    
mysql-libs.i686                            5.1.73-8.el6_8               base    
mysql-libs.x86_64                          5.1.73-8.el6_8               base    
mysql-server.x86_64                        5.1.73-8.el6_8               base    
mysql-test.x86_64                          5.1.73-8.el6_8               base    
pcp-pmda-mysql.x86_64                      3.10.9-9.el6                 base    
php-mysql.x86_64                           5.3.3-49.el6                 base    
qt-mysql.i686                              1:4.6.2-28.el6_5             base    
qt-mysql.x86_64                            1:4.6.2-28.el6_5             base    
rsyslog-mysql.x86_64                       5.8.10-10.el6_6              base    
rsyslog7-mysql.x86_64                      7.4.10-7.el6                 base    

同时通过yum install -y mysql-server mysql mysql-devel命令举办安装

[[email protected] /]# yum list | grep mysql
[[email protected] /]# yum install -y mysql-server mysql mysql-devel

CentOS6.4 安装MySQL。安装成功后得以经过rpm -qi
mysql-server命令查看安装后MySQL的新闻,可以透过service mysqld start
运转服务

[[email protected] /]# rpm -qi mysql-server
Name        : mysql-server                 Relocations: (not relocatable)
Version     : 5.1.73                            Vendor: CentOS
Release     : 8.el6_8                       Build Date: Fri 27 Jan 2017 06:25:43 AM CST
Install Date: Mon 08 May 2017 09:32:41 AM CST      Build Host: c1bm.rdu2.centos.org
Group       : Applications/Databases        Source RPM: mysql-5.1.73-8.el6_8.src.rpm
Size        : 25884131                         License: GPLv2 with exceptions
Signature   : RSA/SHA1, Fri 27 Jan 2017 06:35:28 AM CST, Key ID 0946fca2c105b9de
Packager    : CentOS BuildSystem <http://bugs.centos.org>
URL         : http://www.mysql.com
Summary     : The MySQL server and related files
Description :
MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
client/server implementation consisting of a server daemon (mysqld)
and many different client programs and libraries. This package contains
the MySQL server and some accompanying files and directories.

MySQL首要文件地方:
/var/lib/mysql   mysql数据库的数据库文件存放地点
/var/log mysql数据库的日志输出存放地方
/etc/my.cnf 这是mysql的主配置文件

接下去系统还会唤醒您去设置root的密码

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so,
start the server, then issue the following commands:  
/usr/bin/mysqladmin -u root password ‘new-password’ /usr/bin/mysqladmin
-u root -h ecs-3c46.novalocal password ‘new-password’   Alternatively
you can run: /usr/bin/mysql_secure_installation

本人那边敲入的是

[[email protected] /] /usr/bin/mysqladmin -u root password '123456'

 

设置好root的密码后,可以经过mysql -u root
-p,然后输入密码举行对MySQL访问了。

其它我们得以 通过  chkconfig –list | grep mysqld
命令来查阅mysql服务是或不是开机自动运行,并且经过chkconfig mysqld on
命令来将其设置成开机运营

安顿MySQL远程访问
在CentOS上搭建MySQL进程后,暗中同意的root账户只可以在本机访问的,如若想通过其余机器访问CentOS上的MySQL数据库,需要开展一番布局能够进行访问。
敲入下边发号施令意思就是dba用户同意访问,%是匹配全体的域名,密码是rootpasswd

mysql> USE mysql;
mysql> grant all privileges on *.* to 'dba'@'%' identified by 'rootpasswd' with grant option;
mysql> flush privileges;

设置好之后须要命令service mysqld
restart来重启下数据库,再顺便把防火墙也关了只怕在防火墙上打开3306端口。

假使照旧访问不了?
采取telnet 127.0.0.1
3306下令访问下本机的3306端口,再尤其的话就是云服务器的白名单所致(来自老鸟的判定),笔者明日就是栽在此地了,在张宏的扶持下,在天翼云的云主机上发现了安全组这么些事物。
充足出入规则TCP 3306 0.0.0.0/0 后依旧神跡般的可以访问了。大神威武~
澳门金沙国际 1

安装MySQL,centos6.4安装mysql
首先大家由此命令yum list | grep mysql看看MySQL是或不是被安装过
[[email protected]
/]# yum list | grep mysql 然后透过yum的方…

首先我们通过命令yum list | grep mysql看看MySQL是或不是被设置过

Linux下使用yum安装MySQL,以及运营、登录和长距离访问MySQL数据库。

[root@ecs-3c46 /]# yum list | grep mysql
[root@ecs-3c46 /]# yum list | grep mysql

1、安装

接下来经过yum的章程来展开mysql的数据库安装,首先大家可以输入 yum list |
grep mysql 命令来查阅。

下一场经过yum的情势来展开mysql的数据库安装,首先大家可以输入 yum list |
grep mysql 命令来查看。

翻看有没有安装过:

yum上提供的mysql数据库可下载的版本消息

yum上提供的mysql数据库可下载的版本音讯

yum list installed mysql*

mysql-libs.x86_64                          5.1.73-7.el6                 @base   
apr-util-mysql.x86_64                      1.3.9-3.el6_0.1              base    
bacula-director-mysql.x86_64               5.0.0-13.el6                 base    
bacula-storage-mysql.x86_64                5.0.0-13.el6                 base    
dovecot-mysql.x86_64                       1:2.0.9-22.el6               base    
freeradius-mysql.x86_64                    2.2.6-6.el6_7                base    
libdbi-dbd-mysql.x86_64                    0.8.3-5.1.el6                base    
mod_auth_mysql.x86_64                      1:3.0.0-11.el6_0.1           base    
mysql.x86_64                               5.1.73-8.el6_8               base    
mysql-bench.x86_64                         5.1.73-8.el6_8               base    
mysql-connector-java.noarch                1:5.1.17-6.el6               base    
mysql-connector-odbc.x86_64                5.1.5r1144-7.el6             base    
mysql-devel.i686                           5.1.73-8.el6_8               base    
mysql-devel.x86_64                         5.1.73-8.el6_8               base    
mysql-embedded.i686                        5.1.73-8.el6_8               base    
mysql-embedded.x86_64                      5.1.73-8.el6_8               base    
mysql-embedded-devel.i686                  5.1.73-8.el6_8               base    
mysql-embedded-devel.x86_64                5.1.73-8.el6_8               base    
mysql-libs.i686                            5.1.73-8.el6_8               base    
mysql-libs.x86_64                          5.1.73-8.el6_8               base    
mysql-server.x86_64                        5.1.73-8.el6_8               base    
mysql-test.x86_64                          5.1.73-8.el6_8               base    
pcp-pmda-mysql.x86_64                      3.10.9-9.el6                 base    
php-mysql.x86_64                           5.3.3-49.el6                 base    
qt-mysql.i686                              1:4.6.2-28.el6_5             base    
qt-mysql.x86_64                            1:4.6.2-28.el6_5             base    
rsyslog-mysql.x86_64                       5.8.10-10.el6_6              base    
rsyslog7-mysql.x86_64                      7.4.10-7.el6                 base    
mysql-libs.x86_64                          5.1.73-7.el6                 @base   
apr-util-mysql.x86_64                      1.3.9-3.el6_0.1              base    
bacula-director-mysql.x86_64               5.0.0-13.el6                 base    
bacula-storage-mysql.x86_64                5.0.0-13.el6                 base    
dovecot-mysql.x86_64                       1:2.0.9-22.el6               base    
freeradius-mysql.x86_64                    2.2.6-6.el6_7                base    
libdbi-dbd-mysql.x86_64                    0.8.3-5.1.el6                base    
mod_auth_mysql.x86_64                      1:3.0.0-11.el6_0.1           base    
mysql.x86_64                               5.1.73-8.el6_8               base    
mysql-bench.x86_64                         5.1.73-8.el6_8               base    
mysql-connector-java.noarch                1:5.1.17-6.el6               base    
mysql-connector-odbc.x86_64                5.1.5r1144-7.el6             base    
mysql-devel.i686                           5.1.73-8.el6_8               base    
mysql-devel.x86_64                         5.1.73-8.el6_8               base    
mysql-embedded.i686                        5.1.73-8.el6_8               base    
mysql-embedded.x86_64                      5.1.73-8.el6_8               base    
mysql-embedded-devel.i686                  5.1.73-8.el6_8               base    
mysql-embedded-devel.x86_64                5.1.73-8.el6_8               base    
mysql-libs.i686                            5.1.73-8.el6_8               base    
mysql-libs.x86_64                          5.1.73-8.el6_8               base    
mysql-server.x86_64                        5.1.73-8.el6_8               base    
mysql-test.x86_64                          5.1.73-8.el6_8               base    
pcp-pmda-mysql.x86_64                      3.10.9-9.el6                 base    
php-mysql.x86_64                           5.3.3-49.el6                 base    
qt-mysql.i686                              1:4.6.2-28.el6_5             base    
qt-mysql.x86_64                            1:4.6.2-28.el6_5             base    
rsyslog-mysql.x86_64                       5.8.10-10.el6_6              base    
rsyslog7-mysql.x86_64                      7.4.10-7.el6                 base    

rpm -qa | grep mysql*

而且经过yum install -y mysql-server mysql mysql-devel命令举办安装

并且经过yum install -y mysql-server mysql mysql-devel命令进行安装

查看有没有安装包:

[root@ecs-3c46 /]# yum list | grep mysql
[root@ecs-3c46 /]# yum install -y mysql-server mysql mysql-devel
[root@ecs-3c46 /]# yum list | grep mysql
[root@ecs-3c46 /]# yum install -y mysql-server mysql mysql-devel

yum list mysql*

安装成功后方可通过rpm -qi
mysql-server命令查看安装后MySQL的新闻,可以经过service mysqld start 运营服务

设置成功后能够通过rpm -qi
mysql-server命令查看安装后MySQL的新闻,可以经过service mysqld start 运转服务

安装mysql客户端:

[root@ecs-3c46 /]# rpm -qi mysql-server
Name        : mysql-server                 Relocations: (not relocatable)
Version     : 5.1.73                            Vendor: CentOS
Release     : 8.el6_8                       Build Date: Fri 27 Jan 2017 06:25:43 AM CST
Install Date: Mon 08 May 2017 09:32:41 AM CST      Build Host: c1bm.rdu2.centos.org
Group       : Applications/Databases        Source RPM: mysql-5.1.73-8.el6_8.src.rpm
Size        : 25884131                         License: GPLv2 with exceptions
Signature   : RSA/SHA1, Fri 27 Jan 2017 06:35:28 AM CST, Key ID 0946fca2c105b9de
Packager    : CentOS BuildSystem <http://bugs.centos.org>
URL         : http://www.mysql.com
Summary     : The MySQL server and related files
Description :
MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
client/server implementation consisting of a server daemon (mysqld)
and many different client programs and libraries. This package contains
the MySQL server and some accompanying files and directories.
[root@ecs-3c46 /]# rpm -qi mysql-server
Name        : mysql-server                 Relocations: (not relocatable)
Version     : 5.1.73                            Vendor: CentOS
Release     : 8.el6_8                       Build Date: Fri 27 Jan 2017 06:25:43 AM CST
Install Date: Mon 08 May 2017 09:32:41 AM CST      Build Host: c1bm.rdu2.centos.org
Group       : Applications/Databases        Source RPM: mysql-5.1.73-8.el6_8.src.rpm
Size        : 25884131                         License: GPLv2 with exceptions
Signature   : RSA/SHA1, Fri 27 Jan 2017 06:35:28 AM CST, Key ID 0946fca2c105b9de
Packager    : CentOS BuildSystem <http://bugs.centos.org>
URL         : http://www.mysql.com
Summary     : The MySQL server and related files
Description :
MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
client/server implementation consisting of a server daemon (mysqld)
and many different client programs and libraries. This package contains
the MySQL server and some accompanying files and directories.

yum install mysql

MySQL紧要文件地方:
/var/lib/mysql   mysql数据库的数据库文件存放地方
/var/log mysql数据库的日记输出存放地方
/etc/my.cnf 那是mysql的主配置文件

MySQL主要文件地点:
/var/lib/mysql   mysql数据库的数据库文件存放地点
/var/log mysql数据库的日记输出存放地方
/etc/my.cnf 那是mysql的主配置文件

设置mysql 服务器端:

接下去系统还会唤起您去设置root的密码

接下去系统还会唤醒您去设置root的密码

yum install mysql-server

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

yum install mysql-devel

To do so, start the server, then issue the following commands:

To do so, start the server, then issue the following commands:

2、启动    &&    停止

 

 

数据库字符集设置

/usr/bin/mysqladmin -u root password ‘new-password’

/usr/bin/mysqladmin -u root password ‘new-password’

mysql配置文件/etc/my.cnf中投入default-character-set=utf8

/usr/bin/mysqladmin -u root -h ecs-3c46.novalocal password
‘new-password’

/usr/bin/mysqladmin -u root -h ecs-3c46.novalocal password
‘new-password’

启动mysql服务:

 

 

service mysqld start或者/etc/init.d/mysqld start

Alternatively you can run:

Alternatively you can run:

开机运营:

/usr/bin/mysql_secure_installation

/usr/bin/mysql_secure_installation

chkconfig -add mysqld,查看开机运转设置是或不是中标chkconfig –list | grep
mysql*

作者那边敲入的是

自家那边敲入的是

澳门金沙国际 ,mysqld            0:关闭    1:关闭    2:启用    3:启用    4:启用   
5:启用    6:关闭

[root@ecs-3c46 /] /usr/bin/mysqladmin -u root password '123456'
[root@ecs-3c46 /] /usr/bin/mysqladmin -u root password '123456'

停止:

 

 

service mysqld stop

设置好root的密码后,可以经过mysql -u root
-p,然后输入密码进行对MySQL访问了。

设置好root的密码后,可以经过mysql -u root
-p,然后输入密码举办对MySQL访问了。

3、登录

其余大家得以 通过  chkconfig –list | grep mysqld
命令来查阅mysql服务是还是不是开机自动运行,并且经过chkconfig mysqld on
命令来将其设置成开机运营

其它大家得以 通过  chkconfig –list | grep mysqld
命令来查阅mysql服务是还是不是开机自动运维,并且经过chkconfig mysqld on
命令来将其设置成开机运营

创建root管理员:        mysqladmin -u root password 123456

布局MySQL远程访问
在CentOS上搭建MySQL进度后,暗许的root账户只幸好本机访问的,尽管想通过其他机器访问CentOS上的MySQL数据库,需求开展一番布局可以举办走访。
敲入下边发号施令意思就是dba用户同意访问,%是极度全体的域名,密码是rootpasswd

布局MySQL远程访问
在CentOS上搭建MySQL进程后,专擅认同的root账户只可以在本机访问的,倘使想通过其余机器访问CentOS上的MySQL数据库,需求开展一番布局可以举办访问。
敲入上面发号施令意思就是dba用户同意访问,%是匹配全部的域名,密码是rootpasswd

签到:          mysql -u root -p输入密码即可。

mysql> USE mysql;
mysql> grant all privileges on *.* to 'dba'@'%' identified by 'rootpasswd' with grant option;
mysql> flush privileges;
mysql> USE mysql;
mysql> grant all privileges on *.* to 'dba'@'%' identified by 'rootpasswd' with grant option;
mysql> flush privileges;

忘掉密码:          service mysqld stop

安装好今后需求命令service mysqld
restart来重启下数据库,再顺便把防火墙也关了大概在防火墙上打开3306端口。

设置好之后需要命令service mysqld
restart来重启下数据库,再顺便把防火墙也关了只怕在防火墙上打开3306端口。

mysqld_safe –user=root –skip-grant-tables

假使照旧访问不了?
采纳telnet 127.0.0.1
3306指令访问下本机的3306端口,再尤其的话就是云服务器的白名单所致(来自老鸟的论断),小编前天就是栽在这里了,在张宏的扶持下,在天翼云的云主机上发现了安全组那几个东西。
添加出入规则TCP 3306 0.0.0.0/0 后照旧神迹般的可以访问了。大神威武~
澳门金沙国际 2

设若如故访问不了?
动用telnet 127.0.0.1
3306指令访问下本机的3306端口,再不行的话就是云服务器的白名单所致(来自老鸟的论断),作者后天就是栽在那里了,在张宏的接济下,在天翼云的云主机上发现了安全组那几个事物。
拉长出入规则TCP 3306 0.0.0.0/0 后甚至神蹟般的可以访问了。大神威武~
澳门金沙国际 3

mysql -u root

use mysql

update user set password=password(“new_pass”) where user=”root”;

flush privileges;

肆,远程访问

绽放防火墙的端口号

mysql伸张权限:mysql库中的user表新增一条记下host为“%”,user为“root”。

5、Linux MySQL的多少个紧要目录

数据库目录:        /var/lib/mysql/

配备文件:        /usr/share /mysql(mysql.server命令及布局文件)

连锁命令:        /usr/bin(mysqladmin mysqldump等一声令下)

启航脚本:        /etc/rc.d/init.d/(运维脚本文件mysql的目录)

相关文章