在Ubuntu 18.04 LTS 命令行安装MySql5.7
安装环境
root@~virtual-machine:/etc# cat /etc/issue
Ubuntu 18.04.1 LTS
安装mySql
以下为按照命令,在提示需要输入 [Y/n] 时,输入Y.
root@~virtual-machine:~# sudo apt-get install mysql-server
root@~virtual-machine:~# sudo apt-get install mysql-client
root@~virtual-machine:~# sudo apt-get install libmysqlclient-dev
root@~virtual-machine:~#
安装完成后,进入mySql
root@~virtual-machine:~# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.24-0ubuntu0.18.04.1 (Ubuntu)
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>
建立一个用户并授权。
mysql> GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.03 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
修改mysqld.cnf配置并重启MySQL服务
在安装好后,需要修改MySQL配置,否则其他的数据电脑或虚拟机不能连接该MySQL服务。在/etc/mysql/mysql.conf.d/mysqld.cnf里面,注掉或者删掉“bind-address = 127.0.0.1”,或者将“bind-address = 127.0.0.1修改为“bind-address = 0.0.0.0”
root@~virtual-machine:~# vi /etc/mysql/mysql.conf.d/mysqld.cnf
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
# bind-address = 127.0.0.1
当bind-address修改后,需要重启mySQL服务。
root@~virtual-machine:~# service mysql restart
通过Navicat 或者SQL Developer工具连接
在以上步骤完成后,可以通过Navicat或SQL Developer工具连接到已安装的MySQL。此处使用SQL Developer连接到安装的MySQL。
连接名(M):自己定义
用户名(U):该值为前面创建的用户user
口令(P):该值为前面创建的密码password
主机名(A):主机名为MySQL安装的地址
端口(R):端口为MySQL服务监听端口
---------------------
作者:java_foryou 来源:CSDN
原文:https://blog.csdn.net/java_foryou/article/details/83624663
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 通过 API 将Deepseek响应流式内容输出到前端
· AI Agent开发,如何调用三方的API Function,是通过提示词来发起调用的吗