Ubuntu系统安装mysql

1.查看有没有安装mysql

    dpkg -l | grep mysql

2.更新ubantu包索引

    sudo apt update

 

3.安装mysql

    sudo apt-get install mysql-server

 

4.初始化环境

    sudo mysql_secure_installation

 

 

5.查看mysql服务状态

    systemctl status mysql

 

6.登录mysql

免密码登陆

      vi /etc/mysql/mysql.conf.d/mysqld.cnf

    找到[mysqld]段,并在下面加入一行

    skip-grant-tables

6.1 修改密码命令(在mysql之外进行,可以不登录):
    mysqladmin -uroot -p password 新密码


7.外网访问

  7.1修改配置文件

    netstat -an|grep 3306              # 查看端口
    cd /etc/mysql/mysql.conf.d/        # 切换到目录
    sudo vim mysqld.cnf                # 打开配置文件
    bind-address = 127.0.0.1 修改为 # bind-address = 127.0.0.1  
    service mysql restart              # 重启服务
登录mysql

 


posted on   与太阳肩并肩  阅读(136)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 字符编码:从基础到乱码解决
< 2025年3月 >
23 24 25 26 27 28 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 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示