前言:网上Mysql的安装方式参差不齐,有的装了缺少配置文件,有的装了少库少表 所以现在出一个完整的mysql安装方案 目前安装方式无外乎有下面三种: 装完没有密码,需要自己进去设置密码装完有默
本文使用的正是第三种
mysql官网下载地址:https://dev.mysql.com/downloads/mysql/
root@wdr:/opt# mkdir /opt/mysqlroot@wdr:~# tar -xvf mysql-server_5.7.42-1ubuntu18.04_amd64.deb-bundle.tar -C /opt/mysql/libmysqlclient20_5.7.42-1ubuntu18.04_amd64.deblibmysqlclient-dev_5.7.42-1ubuntu18.04_amd64.deblibmysqld-dev_5.7.42-1ubuntu18.04_amd64.debmysql-client_5.7.42-1ubuntu18.04_amd64.debmysql-common_5.7.42-1ubuntu18.04_amd64.debmysql-commUnity-client_5.7.42-1ubuntu18.04_amd64.debmysql-community-server_5.7.42-1ubuntu18.04_amd64.debmysql-community-source_5.7.42-1ubuntu18.04_amd64.debmysql-community-test_5.7.42-1ubuntu18.04_amd64.debmysql-server_5.7.42-1ubuntu18.04_amd64.debmysql-testsuite_5.7.42-1ubuntu18.04_amd64.debroot@wdr:~#
root@wdr:~# cd /opt/mysql/root@wdr:/opt/mysql# lslibmysqlclient20_5.7.42-1ubuntu18.04_amd64.deb mysql-community-server_5.7.42-1ubuntu18.04_amd64.deblibmysqlclient-dev_5.7.42-1ubuntu18.04_amd64.deb mysql-community-source_5.7.42-1ubuntu18.04_amd64.deblibmysqld-dev_5.7.42-1ubuntu18.04_amd64.deb mysql-community-test_5.7.42-1ubuntu18.04_amd64.debmysql-client_5.7.42-1ubuntu18.04_amd64.deb mysql-server_5.7.42-1ubuntu18.04_amd64.debmysql-common_5.7.42-1ubuntu18.04_amd64.deb mysql-testsuite_5.7.42-1ubuntu18.04_amd64.debmysql-community-client_5.7.42-1ubuntu18.04_amd64.debroot@wdr:/opt/mysql#
dpkg -i mysql-common_5.7.42-1ubuntu18.04_amd64.deb dpkg -i libmysqlclient20_5.7.42-1ubuntu18.04_amd64.deb dpkg -i libmysqlclient-dev_5.7.42-1ubuntu18.04_amd64.deb dpkg -i libmysqld-dev_5.7.42-1ubuntu18.04_amd64.deb dpkg -i mysql-community-server_5.7.42-1ubuntu18.04_amd64.deb
root@wdr:/opt/mysql# dpkg -i mysql-community-server_5.7.42-1ubuntu18.04_amd64.deb Selecting previously unselected package mysql-community-server.(Reading database ... 74128 files and directories currently installed.)Preparing to unpack mysql-community-server_5.7.42-1ubuntu18.04_amd64.deb ...Unpacking mysql-community-server (5.7.42-1ubuntu18.04) ...dpkg: dependency problems prevent configuration of mysql-community-server:mysql-community-server depends on mysql-client (= 5.7.42-1ubuntu18.04); however:Package mysql-client is not installed.mysql-community-server depends on libmecab2; however:Package libmecab2 is not installed.dpkg: error processing package mysql-community-server (--install):dependency problems - leaving unconfiguredProcessing triggers for man-db (2.10.2-1) ...Errors were encountered while processing:mysql-community-server
root@wdr:/opt/mysql# dpkg -i mysql-client_5.7.42-1ubuntu18.04_amd64.deb Selecting previously unselected package mysql-client.(Reading database ... 74290 files and directories currently installed.)Preparing to unpack mysql-client_5.7.42-1ubuntu18.04_amd64.deb ...Unpacking mysql-client (5.7.42-1ubuntu18.04) ...dpkg: dependency problems prevent configuration of mysql-client:mysql-client depends on mysql-community-client (= 5.7.42-1ubuntu18.04); however:Package mysql-community-client is not installed.dpkg: error processing package mysql-client (--install):dependency problems - leaving unconfiguredErrors were encountered while processing:mysql-clientroot@wdr:/opt/mysql#
root@wdr:/opt/mysql# dpkg -i mysql-community-client_5.7.42-1ubuntu18.04_amd64.deb Selecting previously unselected package mysql-community-client.(Reading database ... 74296 files and directories currently installed.)Preparing to unpack mysql-community-client_5.7.42-1ubuntu18.04_amd64.deb ...Unpacking mysql-community-client (5.7.42-1ubuntu18.04) ...dpkg: dependency problems prevent configuration of mysql-community-client:mysql-community-client depends on libtinfo5 (>= 6); however:Package libtinfo5 is not installed.dpkg: error processing package mysql-community-client (--install):dependency problems - leaving unconfiguredProcessing triggers for man-db (2.10.2-1) ...Errors were encountered while processing:mysql-community-client
root@wdr:/opt/mysql# apt --fix-broken installReading package lists... DoneBuilding dependency tree... DoneReading state infORMation... DoneCorrecting dependencies... DoneThe following additional packages will be installed:libmecab2 libtinfo5The following NEW packages will be installed:libmecab2 libtinfo50 upgraded, 2 newly installed, 0 to remove and 50 not upgraded.3 not fully installed or removed.Need to get 298 kB of arcHives.After this operation, 1,432 kB of additional disk space will be used.Do you want to continue? [Y/n]
root@wdr:/opt/mysql# mysql -u root -p123456mysql: [Warning] Using a password on the command line interface can be insecure.Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3Server version: 5.7.42 MySQL Community Server (GPL)Copyright (c) 2000, 2023, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>
mysql> use mysql;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql> mysql> select User,Host from user;+---------------+-----------+| User | Host |+---------------+-----------+| mysql.session | localhost || mysql.sys | localhost || root | localhost |+---------------+-----------+3 rows in set (0.00 sec)mysql>
mysql> update user set host = '%' where user = 'root'; Query OK, 1 row affected (0.00 sec)Rows matched: 1 Changed: 1 Warnings: 0mysql> select User,Host from user;+---------------+-----------+| User | Host |+---------------+-----------+| root | % || mysql.session | localhost || mysql.sys | localhost |+---------------+-----------+3 rows in set (0.00 sec)mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)mysql>
root@wdr:/opt/mysql# vim /etc/mysql/mysql.conf.d/mysqld.cnf
root@wdr:/opt/mysql# systemctl restart mysqlroot@wdr:/opt/mysql#
root@wdr:/opt/mysql# systemctl restart mysqlroot@wdr:/opt/mysql#
来源地址:https://blog.csdn.net/qq_41265137/article/details/130644812
--结束END--
本文标题: Ubuntu安装mysql5.7(适用于大多数ubuntu版本)
本文链接: https://lsjlt.com/news/393576.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0