ubuntu安装mysql依赖关系_ubuntu安装mysql

# 查看有没有安装MySQL:

dpkg -l | grep mysql

# 安装MySQL:

apt install mysql-server

正在读取软件包列表... 完成

正在分析软件包的依赖关系树

正在读取状态信息... 完成

将会同时安装下列软件:

libaio1 libevent-core-2.1-6 libhtml-template-perl mysql-client-5.7

mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7

建议安装:

libipc-sharedcache-perl mailx tinyca

下列【新】软件包将被安装:

libaio1 libevent-core-2.1-6 libhtml-template-perl mysql-client-5.7

mysql-client-core-5.7 mysql-common mysql-server mysql-server-5.7

mysql-server-core-5.7

升级了 0 个软件包,新安装了 9 个软件包,要卸载 0 个软件包,有 237 个软件包未被升级。

需要下载 20.5 MB 的归档。

解压缩后会消耗 160 MB 的额外空间。

您希望继续执行吗? [Y/n]  y

安装完成登录

root@ubuntu:~# mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.7.27-0ubuntu0.18.04.1 (Ubuntu)

Copyright (c) 2000, 2019, 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> grant all on *.* to root@'%' identified by 'root' with grant option;

Query OK, 0 rows affected, 1 warning (0.81 sec)

刷新权限

mysql> flush privileges;

Query OK, 0 rows affected (0.03 sec)

退出

mysql> exit

Bye

重新启动

root@ubuntu:~# systemctl restart mysql

远程登录设置

root@ubuntu:~# mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.7.27-0ubuntu0.18.04.1 (Ubuntu)

Copyright (c) 2000, 2019, 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> use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

设置host属性

mysql> update user set host = '%' where user = 'root';

ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'

报错可以忽略,可能已存在通过查询

mysql> select host from user where user='root';

修改配置文件

root@ubuntu:~# sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf

找到bind 127.0.0.1 ::1 这一行将它注释掉

root@ubuntu:~# service mysql restart

完成

mysql官网上下载mysql-server_5.7.21-1ubuntu14.04_amd64.deb-bundle.tar,然后进行离线安装,解压该安装包,会出现11个依赖包,按照顺序依次使用sudo dpkg -i 进行安装间会报错,显示缺少相应的依赖,具体如下: *******@ubuntu:/opt/mysql$ sudo dpkg -i mysql-community-client_5.7.21-1ubuntu14.04_amd64.deb Selecting previously unselected package mysql-community-client. (Reading database ... 208518 files and directories currently installed.) Preparing to unpack mysql-community-client_5.7.21-1ubuntu14.04_amd64.deb ... Unpacking mysql-community-client (5.7.21-1ubuntu14.04) ... dpkg: dependency problems prevent configuration of mysql-community-client: mysql-community-client depends on libaio1 (>= 0.3.93); however: Package libaio1 is not installed. dpkg: error processing package mysql-community-client (--install): dependency problems - leaving unconfigured Processing triggers for man-db (2.6.7.1-1ubuntu1) ... Errors were encountered while processing: mysql-community-client 和 ********@ubuntu:/opt/mysql$ sudo dpkg -i mysql-community-server_5.7.21-1ubuntu14.04_amd64.deb Selecting previously unselected package mysql-community-server. (Reading database ... 208598 files and directories currently installed.) Preparing to unpack mysql-community-server_5.7.21-1ubuntu14.04_amd64.deb ... Unpacking mysql-community-server (5.7.21-1ubuntu14.04) ... dpkg: dependency problems prevent configuration of mysql-community-server: mysql-community-server depends on libmecab2 (>= 0.996-1.1); however: Package libmecab2 is not installed. dpkg: error processing package mysql-community-server (--install): dependency problems - leaving unconfigured Processing triggers for man-db (2.6.7.1-1ubuntu1) ... Processing triggers for ureadahead (0.100.0-16) ... ureadahead will be reprofiled on next reboot Errors were encountered while processing: mysql-community-server 附上依赖安装顺序: 1.mysql-common_5.7.21-1ubuntu14.04_amd64.deb 2.libmysqlclient20_5.7.21-1ubuntu14.04_amd64.deb 3.libmysqlclient-dev_5.7.21-1ubuntu14.04_amd64.deb 4.libmysqld-dev_5.7.21-1ubuntu14.04_amd64.deb
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值