centOS7环境在线安装mysql
程序员文章站
2024-01-27 14:13:10
...
第一步检查是否已安装
1:检查是否本地已经安装了mysql
rpm -qa | grep mysql
2:卸载以前的mysql
rpm -e 已经存在的MySQL全名
开始安装
保持联网状态下,现在执行下面命令
yum install mysql
继续执行下面命令:
yum install mysql-devel
执行命令过程中遇到类似这样的都是输入y,继续
总计:8.9 M
总下载量:3.4 M
Is this ok [y/d/N]:
然后执行下面3个命令:
# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# rpm -ivh mysql-community-release-el7-5.noarch.rpm
# yum install mysql-community-server
执行完,重启mysql服务。
# service mysqld restart
然后即可登录mysql,初始登录没有密码
[aaa@qq.com ~]# service mysqld restart
Redirecting to /bin/systemctl restart mysqld.service
[aaa@qq.com ~]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.40 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>
初次登录设置一下密码,设置为123456
mysql> set password for 'root'@'localhost' =password('123456');
Query OK, 0 rows affected (0.02 sec)
退户登录
mysql> exit
Bye
[root@slave1 ~]#
配置mysql
# vim /etc/my.cnf
在最后面添加下面内容
[mysql]
default-character-set =utf8
配置mysql远程链接
设置远程访问账号:grant all privileges on . to 远程访问用户名@’%’ identified by ‘用户密码’;
mysql> grant all privileges on *.* to aaa@qq.com'%' identified by '123456';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql>
配置完即可通过navicat工具远程连接上
如果还是连接不上,估计是防火墙问题,本文不做详细介绍了,目前没有这样的环境作为说明
推荐阅读
-
CentOS7环境安装Docker详解
-
[CentOS7环境搭建](一)VM中安装CentOS7
-
测试环境搭建:CentOS7环境装JDK+Nginx+Redis+MySql
-
[CentOS7环境搭建](三)安装JDK
-
centOS7环境在线安装mysql
-
[CentOS7环境搭建](七)安装RabbitMQ
-
简单几步在Linux的CentOS7环境安装并配置Redis
-
本地安装Java环境,安装Tomcat,安装Mysql;本地创建IDEA Java EE项目并用JDBC连接Mysql读取数据。
-
MySQL的安装、使用环境及其基本工具的使用
-
Mysql安装和环境变量设置及破解密码_MySQL