linux mysql 配置远程,Linux下安装MySQL并配置远程访问

66b52468c121889b900d4956032f1009.png

8种机械键盘轴体对比

本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选?

基于Centos 7的MySQL安装与配置

一、下载

选择版本,分别下载MySQL Server(服务端)和Client Utilities(客户端)

二、安装

检查是否安装过Mysql1rpm -qa|grep -i mysql

安装Msql -server 1rpm -ivh MySQL-server-5.5.48-1.linux2.6.x86_64.rpm

若出现报错1

2警告:MySQL-server-5.5.48-1.linux2.6.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY

准备中... ################################# [100%]

这是由于yum安装了旧版本的GPG keys造成的,解决办法1rpm --import /etc/pki/rpm-gpg/RPM*

然后在rpm安装命令后添加1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23rpm -ivh MySQL-server-5.5.48-1.linux2.6.x86_64.rpm --force --nodeps

准备中... ################################# [100%]

正在升级/安装...

1:MySQL-server-5.5.48-1.linux2.6 ################################# [100%]

180703 21:16:27 [Note] /usr/sbin/mysqld (mysqld 5.5.48) starting as process 1567 ...

180703 21:16:27 [Note] /usr/sbin/mysqld (mysqld 5.5.48) starting as process 1574 ...

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 localhost.localdomain password 'new-password'

Alternatively you can run:

/usr/bin/mysql_secure_installation

which will also give you the option of removing the test

databases and anonymous user created by default. This is

strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at http://bugs.mysql.com/

接下来安装Mysql-client1rpm -ivh MySQL-client-5.5.48-1.linux2.6.x86_64.rpm --force --nodeps

查看是否安装成功1

2

3[[email protected] opt]# rpm -qa|grep -i mysql

MySQL-client-5.5.48-1.linux2.6.x86_64

MySQL-server-5.5.48-1.linux2.6.x86_64

查看安装版本1

2[[email protected] ~]# mysqladmin --version

mysqladmin Ver 8.42 Distrib 5.5.48, for Linux on x86_64

启动MySQL服务1

2[[email protected] opt]# service mysql start

Starting MySQL.. SUCCESS!

若报错

Starting MySQL……The server quit without updating PID file (/var/lib/mysql//localhost.pid). [FAILED]

删除/etc/my.cnf即可

三、配置MySQL

配置密码1/usr/bin/mysqladmin -u root password 123

自启动MySQL服务1chkconfig mysql on

一、配置文件修改

拷贝默认配置文件到 /etc 目录下1cp /usr/share/mysql/my-huge.cnf /etc/my.cnf

配置编码格式1vim /etc/my.cnf

修改如下3处1

2

3

4

5

6

7

8

9

10

11

12

13[client]

password = your_password

port = 3306

socket = /var/lib/mysql/mysql.sock

default-character-set=utf8

[mysqld]

port = 3306

character_set_server = utf8

character_set_client = utf8

collation_server = utf8_general_ci

[mysql]

no-auto-rehash

default-character-set=utf8

重启mysql服务1

2service mysql stop

service mysql start

四、配置远程访问MySQL

1、MySQL配置1

2mysql>use mysql;

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

2、centos配置

centos查询端口是不是开放的1firewall-cmd --permanent --query-port=3306/tcp

开启端口1firewall-cmd --permanent --add-port=3306/tcp

重启防火墙1firewall-cmd --reload

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值