使用ubuntu下载mysql_数据库应用(一): Ubuntu 下 MySQL 的 配置

个人运气比较差,第一次装mysql为了和QT对接,结果发下QT 要求试 MySQL 32位 的 装上去之后发现有bug 然后卸掉之后发现一个东西一直卸不掉,导致无法重新安装Mysql,成天以sqlite度日

d870dc14d12587ea8723a8918299545f.png就是这玩意,打死没卸掉

现在 要上实训课, 所以开启我两年前装的Ubuntu(捂脸),来安装一下MySQL

进入正题

第一步:

很显然得更新一下系统的软件源 sudo apt-get update 界面我就不给了,更新完,接着 就是 安装 mysql 了

一样 使用 apt 获取软件包  sudo apt-get install mysql-server ,回车后界面如下

450b3cfac87b7e2bc1fb9a0c96c3d449.png

回车继续即可

第二步

配置 Mysql ,命令行如下

sudo mysql_secure_installation

结果如图

0a0898a32bb08e448bee05e63138bcb2.png

配置界面如下:

#1VALIDATE PASSWORD PLUGIN can be used to test passwords...

Press y|Y for Yes, any other key forNo: N (我的选项)

#2Pleaseset the password forroot here...

New password: (输入密码)

Re-enter newpassword: (重复输入)

#3Bydefault, a MySQL installation has an anonymous user,

allowing anyone to log into MySQL without having to have

a user account createdforthem...

Remove anonymous users? (Press y|Y for Yes, any other key forNo) : N (我的选项)

#4Normally, root should only be allowed to connectfrom

'localhost'. This ensures that someone cannot guess at

the root passwordfromthe network...

Disallow root login remotely? (Press y|Y for Yes, any other key forNo) : Y (我的选项)

#5Bydefault, MySQL comes with a database named 'test'that

anyone can access...

Remove test database and access to it? (Press y|Y for Yes, any other key forNo) : N (我的选项)

#6Reloading the privilege tables will ensure that all changes

made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y (我的选项)

不同选项会有不同触发,认真看,英语不好翻译一下

接着来检查mysql服务状态

systemctl status mysql.servicus mysql.service

虽然说mysql不配置文件只能进行本地访问,不过用于 学习使用也是足够了

进入方法和window一样

mysql -u root -p

要注意, Ubuntu下要在 root模式下 输入这行命令

如图:

ea547109f6c3cd42d8ccded1e85aa8f9.png

最后记录一下 启动和重启 命令

启动mysql:

方式一:sudo/etc/init.d/mysql start

方式二:sudo service mysql start

停止mysql:

方式一:sudo/etc/init.d/mysql stop

方式二:sudo service mysql stop

重启mysql:

方式一:sudo/etc/init.d/mysql restart

方式二:sudo service mysql restart

学习不易,诸君共勉!

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值