热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Linux上安装MySQL以及Navicat连接双系统Course——justlookit!

我是灼灼,一只初学Java的大一金渐层。向往余秀华和狄兰托马斯的疯狂,时常沉溺于将情感以诗相寄;追逐过王尔德、王小波的文字,

我是灼灼,一只初学Java的大一金渐层。
向往余秀华和狄兰·托马斯的疯狂,时常沉溺于将情感以诗相寄;追逐过王尔德、王小波的文字,后陷于毛姆和斯蒂芬·金不可自拔;热爱文学的浪潮,白日梦到底却总在现实里清醒;艳羡平静又极度渴盼奔跑的力量。
欢迎与我交流鸭· QQ:1517526827;
个人博客:https://blog.csdn.net/weixin_52777510?spm=1001.2101.3001.5343


Linux上安装MySQL以及navicat连接双系统

文章目录

  • Linux上安装MySQL以及navicat连接双系统
    • Linux安装MySQL教程转载:
        • (高能预警!!!真的是一个蠢货小白的报错记录史)
    • Linux安装MySQL第二种方式笔记:
            • start load!
      • 卸载Maria
      • 创建MySQL用户和组
      • //MySQL安装前准备(错误积累,看第二次安装吧)
      • MySQL安装前准备
      • 配置my.cnf文件
      • 安装MySQL
    • navicat for MySQL for Windows连接
      • 一些细节:
    • 戳一下重点~
      • Get!


Linux安装MySQL教程转载:

1)yum命令安装(非常方便的方式)大佬教程在这里

安装过程没有截图,因为之前安装不成功重装了虚拟机,所以过程异常顺利!

大家如果有报错的话直接百度,都可以搜到正解;如果仍然无法解决,很大可能是因为之前的MySQL安装残留的问题(来自Linux&MySQL小白血的教训,如果是,当断则断,立刻重装虚拟机吧~)!

2)如果有想看另一种tar压缩包安装方式的小伙伴,这里有我之前尝试的几个安装教程以及安装过程中报错的一些解决办法,可以参考,当然了千万不要信以为真!(我安装没有成功,二进制包没有内置配置文件,纯手打的,且最终报错无数,一直无法改正,要哭了,所以换了第一种办法~如果有相似经历的小朋友,一定要记住我说的,立刻重装虚拟机吧,无法挽救了!!!)

下面是之前错误安装的一点点笔记:

参考教程们:来啦!

一、二、三;

(高能预警!!!真的是一个蠢货小白的报错记录史)


Linux安装MySQL第二种方式笔记:

首先发现桥接模式连不上网,换成了nat模式;

成功联网并显示ip地址(命令ifconfig)!

start load!

卸载Maria

1.查询已经默认安装的Maria DB

[root@centosxxxxx xxxxx]# rpm -qa|grep maria*

查询命令

#rpm -qa //#号代表root权限

显示出多个已经安装好的文件名

marisa-0.2.4-4.el7.x86_64
mariadb-server-5.5.65-1.el7.x86_64
mariadb-5.5.65-1.el7.x86_64
mariadb-libs-5.5.65-1.el7.x86_64

2.依次删除以卸Maria DB

[root@centosxxxxx xxxxx]# rpm -e --nodeps mariadb-server-5.5.65-1.el7.x86_64
[root@centosxxxxx xxxxx]# rpm -e --nodeps mariadb-5.5.65-1.el7.x86_64
[root@centosxxxxx xxxxx]# rpm -e --nodeps mariadb-libs-5.5.65-1.el7.x86_64

删除命令

#rpm -e --nodeps 文件名

3.重新执行第一步查询命令确认是否完全卸载

[root@centosxxxxx xxxxx]# rpm -qa|grep maria*

仅显示出一个文件,表示卸载完成

marisa-0.2.4-4.el7.x86_64

4.删除etc目录下的my.cnf

[root@centosxxxxx xxxxx]# rm /etc/my.cnf

删除文件命令

#rm /目录名/文件名

显示没有这个文件,那应该不用删除了

rm: cannot remove ‘/etc/my.cnf’: No such file or directory


创建MySQL用户和组

1.创建MySQL用户组

[root@centosxxxxx xxxxx]# groupadd mysql

不清楚是怎么回事,Home里面空空的…

groupadd: group ‘mysql’ already exists

2.添加MySQL用户,添加到MySQL用户组

[root@centosxxxxx xxxxx]# useradd -g mysql mysql

基于此…

useradd: user ‘mysql’ already exists

唉,我决定重新建个用户,叫mygzz…(后面放弃掉了,分不清组和用户)

[root@centosxxxxx xxxxx]# useradd -g mygzz mysql

这里要注意,前面是用户组,后面是用户,我写错了…

useradd: group ‘mygzz’ does not exist

这样应该就行了~

[root@centosxxxxx xxxxx]# useradd -g mysql mygzz


//MySQL安装前准备(错误积累,看第二次安装吧)

1.将下载好的安装包移动到/user/local/目录下

这里应该得把压缩文件传输过来,我先试一下~

xftp传输成功!目标是/home/xxxxx/download(PS:这个xxxxxx在虚拟机显示不出来~)

然后剪切复制到了/home/user/local目录下

2.尝试解压命令

[root@centosxxxxx xxxxx]#tar -zxvf mysql-8.0.23-linux-glibc2.12-x86_64.tar.xz

报错:

tar (child): mysql-8.0.23-linux-glibc2.12-x86_64.tar.xz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

可能是因为没有安装组件的缘故,所以

3.安装组件xz命令

[root@centosxxxxx xxxxx]# yum install -y xz

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile

  • base: mirror.lzu.edu.cn
  • extras: mirror.lzu.edu.cn
  • updates: mirror.lzu.edu.cn
    base | 3.6 kB 00:00:00
    extras | 2.9 kB 00:00:00
    updates | 2.9 kB 00:00:00
    updates/7/x86_64/primary_db | 4.7 MB 00:00:06
    Package xz-5.2.2-1.el7.x86_64 already installed and latest version
    Nothing to do(这里组件没有安装上,不知道为啥,wget包是存在的)

4.安装组件后仍然报错如上

第二次安装~

MySQL安装前准备

1.将下载好的安装包移动到/user/local/目录下

移动命令:

[root@centosxxxxx Downloads]# mv mysql-8.0.23-linux-glibc2.12-x86_64.tar.xz /usr/local/

下面这些命令的原因是,一定要弄清楚自己的虚拟机上面的目录,然后正确的按照绝对路径转入~

[root@centosxxxxx]# ls
Desktop Documents Downloads Music Pictures Public Templates user Videos
[root@centosxxxxx]# cd Downloads

注意:

cd / 目录名 是打开某一个目录

cd 目录名 是打开子目录

2.解压安装包

应该先转到该压缩包的目录下面~

[root@centosxxxxx Downloads]# cd /usr/local
[root@centosxxxxx local]# tar -zxvf mysql-8.0.23-linux-glibc2.12-x86_64.tar.xz

解压命令:

[root@centosxxxxx local]# tar -zxvf mysql-8.0.23-linux-glibc2.12-x86_64.tar.xz

新的报错:

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

解决,新的解压命令~

[root@centosxxxxx local]# tar -xvf mysql-8.0.23-linux-glibc2.12-x86_64.tar.xz

安装了一堆东西,成功!

解压命令变了,为什么要这样变?

第一种:

tar包压缩的时候用cvf参数,解压的时候用xvf参数
或压缩的时候用czvf参数,解压的时候用xzvf参数

具体解释可以参照博客,重点如下:

tar -xvf file.tar //解压 tar包

tar -xzvf file.tar.gz //解压tar.gz

这样就明白了,因为解压的是xz包!

3.将解压后的文件夹重命名为mysql

[root@centosxxxxx local]# mv mysql-8.0.23-linux-glibc2.12-x86_64 mysql

应该是成功了~

配置my.cnf文件

1.将/usr/local/mysql/support-files路径下的my-default.cnf文件拷贝到/etc/my.cnf命名为my.cnf

[root@centosxxxxx support-files]# cp my-default.cnf /etc/my.cnf
cp: cannot stat ‘my-default.cnf’: No such file or directory
[root@centosxxxxx support-files]# ls
mysqld_multi.server mysql-log-rotate mysql.server
[root@centosxxxxx support-files]# ll
total 20
-rwxr-xr-x. 1 7161 31415 1061 Dec 11 15:42 mysqld_multi.server
-rw-r–r--. 1 7161 31415 2048 Dec 11 18:22 mysql-log-rotate
-rwxr-xr-x. 1 7161 31415 10576 Dec 11 18:22 mysql.server

。。。。。。。。。没有默认配置文件。。。。。。。。。。。。。

自己手动写一个!命令:

[root@centosxxxxx support-files]# vim /etc/my.cnf

my.cnf内容如下:

[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
socket=/var/lib/mysql/mysql.sock
[mysqld]
skip-name-resolve
#设置3306端口
port = 3306
socket=/var/lib/mysql/mysql.sock
# 设置mysql的安装目录
basedir=/usr/local/mysql
# 设置mysql数据库的数据的存放目录
datadir=/usr/local/mysql/data
# 允许最大连接数
max_connections=1000
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
lower_case_table_name=1
max_allowed_packet=16M

输入完毕,带#号的不输;

发生了一点意外,我还编辑了这个=_=

在mysql目录下面新建一个my.cnf文件

vi /home/mysql/port-3306/my.cnf

安装MySQL

1.进入到mysql文件目录下,执行命令

#cd /usr

#cd local

#cd mysql

修改当前目录拥有者为mysql用户,想写mygzz来着,不可行

*chown -R mysql:mysql ./ *

安装数据库

[root@localhost mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/

这个是旧版本的查询命令,新版本是这个,输入了很多次,很多很多很多次,但是,报错老是那样…

mysql目录下面:

./bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/mysql --initialize

网上找到的解决方法:

yum -y install libaio

yum -y install autoconf

yum -y install perl perl-devel

这个可能有的安装上了,有的缺wget包?但是我是安装了wget包的。。。。

后来又查到了安装common的办法:

命令:

rpm -ivh mysql-community-common-8.0.17-1.el7.x86_64.rpm --nodeps --force

改过版本但是不能安装,检查安装的MySQL的rpm也并不存在这些依赖…

还有的依赖包括:

rpm -ivh mysql-community-libs-8.0.17-1.el7.x86_64.rpm --nodeps --force

rpm -ivh mysql-community-client-8.0.17-1.el7.x86_64.rpm --nodeps –

rpm -ivh mysql-community-server-8.0.17-1.el7.x86_64.rpm --nodeps --force

rpm -qa | grep mysql

接下来仍然是初始化:

mysqld --initialize; 初始化mysql
chown mysql:mysql /var/lib/mysql -R; 对操作文件赋予权限
systemctl start mysqld.service; 启动mysql服务
systemctl enable mysqld; 设置开机自启

试过第一个命令,好像是mysqld不可以用;

接着使用之前的初始化命令,等着的就是一直报错,报错查询了之后,有的直接查不到,有的解决方案不适用于我这个;特别是第一个报错,0就是官方文档要求是1,一就是不存在这个东西,然后一的报错直接查不到,第二个报错和第三个是一起的,解决方法是bin-log,这个我不会改,也不敢改…

报错:

[ERROR] [MY-000067] [Server] unknown variable ‘lower_case_table_name=0’.
2021-01-19T19:10:36.064108Z 0 [ERROR] [MY-013455] [Server] The newly created data directory /usr/local/mysql/data/ by --initialize is unusable. You can remove it.
2021-01-19T19:10:36.064904Z 0 [ERROR] [MY-010119] [Server] Aborting

找到的另外的配置文件:

[client]
default-character-set=utf8
#password = your_password
port = 3306
socket = /tmp/mysql.sock

[mysqld]
#sql_mode=STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION
character-set-server=utf8mb4
port = 3306
socket = /tmp/mysql.sock
basedir = /usr/local/mysql/
datadir = /usr/local/mysql/data/

skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
init_connect=‘SET NAMES utf8’

#错误日志配置

log-error = /usr/local/mysql/log/error.log
pid-file = /usr/local/mysql/run/mysql.pid

#慢日志设置
slow_query_log=1
long_query_time=2
slow_query_log_file=/usr/local/mysql/log/slow_query.log

#bin-log二进制日志设置

log-bin=/usr/local/mysql/log/mysqlbin/mysql-bin

#logging format: mixed|statement|row

binlog_format=statement

#主从配置

#required unique id between 1 and 2^32 - 1 defaults to 1 if master-host is not set

server-id = 1

#Innodb配置
innodb_data_home_dir = /usr/local/mysql/data
#innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /usr/local/mysql/data

#You can set …_buffer_pool_size up to 50 - 80 %

#of RAM but beware of setting memory usage too high

innodb_buffer_pool_size = 128M
innodb_additional_mem_pool_size = 10M

#Set …_log_file_size to 25 % of buffer pool size

innodb_log_file_size = 32M
innodb_log_buffer_size = 10M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 10

[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M

结果是没有安装成功。。。。。

初始化命令:

mysqld initialize

报错:命令找不到

bash: mysqld not found;

解决:配置环境变量在etc/profile文件下;

文件的全部内容:

#/etc/profile

#System wide environment and startup programs, for login setup

#Functions and aliases go in /etc/bashrc

#It’s NOT a good idea to change this file unless you know what you

#are doing. It’s much better to create a custom.sh shell script in

#/etc/profile.d/ to make custom changes to your environment, as this

#will prevent the need for merging in future updates.

pathmunge () {
case “😒{PATH}:” in
星号:"$1":星号)
;;
*)
if [ "2"="after"];thenPATH=2" = "after" ] ; then PATH=2"="after"];thenPATH=PATH:$1
else
PATH=1:1:1:PATH
fi
esac
}

if [ -x /usr/bin/id ]; then
if [ -z “$EUID” ]; then

​ ksh workaround

​ EUID=/usr/bin/id -u
​ UID=/usr/bin/id -ru
​ fi
​ USER="/usr/bin/id -un"
​ LOGNAME=USER​MAIL="/var/spool/mail/USER ​ MAIL="/var/spool/mail/USERMAIL="/var/spool/mail/USER"
fi

#Path manipulation

if [ “$EUID” = “0” ]; then
pathmunge /usr/sbin
pathmunge /usr/local/sbin
else
pathmunge /usr/local/sbin after
pathmunge /usr/sbin after
fi

HOSTNAME=/usr/bin/hostname 2>/dev/null
HISTSIZE=1000
if [ “$HISTCONTROL” = “ignorespace” ] ; then

​ export HISTCONTROL=ignoreboth
else
​ export HISTCONTROL=ignoredups
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL

#By default, we want umask to get set. This sets it for login shell

#Current threshold for system reserved uid/gids is 200

#You could check uidgid reservation validity in

#/usr/share/doc/setup-*/uidgid file

if [ $UID -gt 199 ] && [ “/usr/bin/id -gn” = “/usr/bin/id -un” ]; then
umask 002
else
umask 022
fi

for i in /etc/profile.d/*.sh /etc/profile.d/sh.local ; do
if [ -r “i"];thenif["i" ]; then if [ "i"];thenif["{-#*i}” != “−"];then."-" ]; then . ""];then."i”
else
. “$i” >/dev/null

​ fi
​ fi
done

unset i
unset -f pathmunge

export PATH=$PATH:/usr/local/mysql/bin

以上。。。

报错:

#mysqld --initialize

2021-01-24T16:16:28.345590Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.23) initializing of server in progress as process 3892
2021-01-24T16:16:28.347486Z 0 [Warning] [MY-013242] [Server] --character-set-server: ‘utf8’ is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2021-01-24T16:16:28.348490Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2021-01-24T16:16:28.348505Z 0 [ERROR] [MY-013236] [Server] The designated data directory /usr/local/mysql/data/ is unusable. You can remove all files that the server added to it.
2021-01-24T16:16:28.348652Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-01-24T16:16:28.348934Z 0 [System] [MY-010910] [Server] /usr/local/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.23) MySQL Community Server - GPL.

安装报错:

[Server] Fatal error: Please read “Security” section of the manual to find out how to run mysqld as root!

添加配置文件:

explict defaults_for_timestamp=true
user=mysql

文件只读如何修改:

:w!命令强制存盘

新的报错:

2021-01-24T17:09:30.215588Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.23) initializing of server in progress as process 5184
2021-01-24T17:09:30.218209Z 0 [Warning] [MY-013242] [Server] --character-set-server: ‘utf8’ is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2021-01-24T17:09:30.254015Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-01-24T17:09:31.722667Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-01-24T17:09:35.871163Z 0 [ERROR] [MY-000067] [Server] unknown variable ‘lower_case_table_name=1’.
2021-01-24T17:09:35.873453Z 0 [ERROR] [MY-013455] [Server] The newly created data directory /usr/local/mysql/data/ by --initialize is unusable. You can remove it.
2021-01-24T17:09:35.877439Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-01-24T17:09:38.112006Z 0 [System] [MY-010910] [Server] /usr/local/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.23) MySQL Community Server - GPL.

新新的报错:

root@centosxxxxx mysql]# mysqld -initialize
2021-01-24T17:32:35.727186Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.23) starting as process 5587
2021-01-24T17:32:35.757000Z 0 [Warning] [MY-013242] [Server] --character-set-server: ‘utf8’ is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2021-01-24T17:32:35.798894Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-01-24T17:32:36.945875Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
mysqld: Table ‘mysql.plugin’ doesn’t exist
2021-01-24T17:32:37.403518Z 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure.
2021-01-24T17:32:37.404332Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2021-01-24T17:32:37.405598Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2021-01-24T17:32:37.406296Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2021-01-24T17:32:37.407569Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2021-01-24T17:32:37.408198Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2021-01-24T17:32:37.409062Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2021-01-24T17:32:37.409647Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2021-01-24T17:32:37.415768Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: ‘::’ port: 33060, socket: /tmp/mysqlx.sock
2021-01-24T17:32:37.817054Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table ‘mysql.gtid_executed’ cannot be opened.
2021-01-24T17:32:37.898731Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table ‘mysql.gtid_executed’ cannot be opened.
2021-01-24T17:32:37.904639Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-01-24T17:32:37.904878Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-01-24T17:32:37.907691Z 0 [ERROR] [MY-010273] [Server] Could not create unix socket lock file /var/lib/mysql/mysql.sock.lock.
2021-01-24T17:32:37.907961Z 0 [ERROR] [MY-010268] [Server] Unable to setup unix socket lock file.
2021-01-24T17:32:37.908466Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-01-24T17:32:38.839744Z 0 [System] [MY-010910] [Server] /usr/local/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.23) MySQL Community Server - GPL.

改正一:

[root@centosxxxxx mysql]# mysql_upgrade
The mysql_upgrade client is now deprecated. The actions executed by the upgrade client are now done by the server.
To upgrade, please start the new MySQL binary with the older data directory. Repairing user tables is done automatically. Restart is not required after upgrade.
The upgrade process automatically starts on running a new MySQL binary with an older data directory. To avoid accidental upgrades, please use the --upgrade=NONE option with the MySQL binary. The option --upgrade=FORCE is also provided to run the server upgrade sequence on demand.
It may be possible that the server upgrade fails due to a number of reasons. In that case, the upgrade sequence will run again during the next MySQL server start. If the server upgrade fails repeatedly, the server can be started with the --upgrade=MINIMAL option to start the server without executing the upgrade sequence, thus allowing users to manually rectify the problem.

最新解决:

[root@centosxxxxx mysql]# mysqld initialize
mysqld: File ‘./binlog.index’ not found (OS errno 13 - Permission denied)
2021-01-24T17:59:16.882755Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.23) starting as process 6295
2021-01-24T17:59:16.885072Z 0 [Warning] [MY-013242] [Server] --character-set-server: ‘utf8’ is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2021-01-24T17:59:16.886821Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-01-24T17:59:16.887076Z 0 [System] [MY-010910] [Server] /usr/local/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.23) MySQL Community Server - GPL.

如果真的有小朋友看到这里的话,哈哈,你真是个小可爱!!!

再见再见,纯属无聊小白的error记录史,博君一笑罢了~

navicat for MySQL for Windows连接

安装正常~~没有安装的同学请移步我的安装教程博客(忘记了过不了审没有发…好尴尬)~

这里推一个别的安装教程

嘿嘿嘿~

连接时出现问题,报错:

1251-Client does not support authentication protocol requested by sever;consider upgrading MYSQL client.

解决办法:参考自博客

提供的完整命令如下:

cmd窗口登陆mysql:

C:\Users\Administrator> sqlplus /nolog


mysql> conn / as sysdba;(注意分号)


mysql> alter user ‘root’@‘localhost’ identified with mysql_native_password by ‘123456’;(注意分号)

Query OK, 0 rows affected (0.10 sec)

mysql> flush privileges;(注意分号)

Query OK, 0 rows affected (0.01 sec)

一些细节:

一共有四个命令,但是我只能正常使用两个;

第一个要求直接以管理员身份运行后输入,我输入后报错;且无法进入mysql命令行;

解决办法:

还是按照之前的打开方式,转到bin目录后,进行登录,然后直接输入第三个命令(第二个试了但是不行)

我的成功截图:

在这里插入图片描述

navicat for mysql 输入password之后连接成功!!!

戳一下重点~

这里解决navicat连接的问题其实本质上是改变了你的密码,或者可以说如果无法连接你可以直接尝试改密,再重新启动~

所以要记住自己的密码已经被改变了噢,再次登录要换换啦!

Get!

在这里插入图片描述
如果对你有帮助的话不要忘记一键三连噢~
谢谢鸭~

初次编写于2021/1/27日;


推荐阅读
  • 安装mysqlclient失败解决办法
    本文介绍了在MAC系统中,使用django使用mysql数据库报错的解决办法。通过源码安装mysqlclient或将mysql_config添加到系统环境变量中,可以解决安装mysqlclient失败的问题。同时,还介绍了查看mysql安装路径和使配置文件生效的方法。 ... [详细]
  • 阿里云主机实战应用之centos7上的防火墙设置
    最近公司又上了一台服务器,以前都是用centos6系统,这次选择使用了centos7系统的安装镜像,因为现在程序版本在centos7上一般php默认就是5.4以上的,mysql也 ... [详细]
  • centos7如何利用yum安装mysql 8.0.12
    这篇文章将为大家详细讲解有关centos7如何利用yum安装mysql8.0.12,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有 ... [详细]
  • 篇首语:本文由编程笔记#小编为大家整理,主要介绍了CentOS7编译mysql8.0.12相关的知识,希望对你有一定的参考价值。步骤一:安装 ... [详细]
  • 本文介绍了如何使用C#制作Java+Mysql+Tomcat环境安装程序,实现一键式安装。通过将JDK、Mysql、Tomcat三者制作成一个安装包,解决了客户在安装软件时的复杂配置和繁琐问题,便于管理软件版本和系统集成。具体步骤包括配置JDK环境变量和安装Mysql服务,其中使用了MySQL Server 5.5社区版和my.ini文件。安装方法为通过命令行将目录转到mysql的bin目录下,执行mysqld --install MySQL5命令。 ... [详细]
  • r2dbc配置多数据源
    R2dbc配置多数据源问题根据官网配置r2dbc连接mysql多数据源所遇到的问题pom配置可以参考官网,不过我这样配置会报错我并没有这样配置将以下内容添加到pom.xml文件d ... [详细]
  • 树莓派语音控制的配置方法和步骤
    本文介绍了在树莓派上实现语音控制的配置方法和步骤。首先感谢博主Eoman的帮助,文章参考了他的内容。树莓派的配置需要通过sudo raspi-config进行,然后使用Eoman的控制方法,即安装wiringPi库并编写控制引脚的脚本。具体的安装步骤和脚本编写方法在文章中详细介绍。 ... [详细]
  • Linux环境中使用Mysql数据库
    Linux下Mysql数据库MySQL是一个开放源码的小型关联式数据库管理系统,开发者为瑞典MySQLAB公司,目前属于Oracle公司,MySQL被广泛地应用在I ... [详细]
  • Centos7安装MySql5.6
    如何在CentO ... [详细]
  • 本文是搭建的mariadb-10.0.17版本的下载地址:https:downloads.mariadb.orginterstitialmariadb-10.0.17sourcemariadb-10.0.17.tar.gzfromhtt ... [详细]
  • 1.ATP方式安装在ubuntu系统的apt软件仓库中,默认存在MySQL数据库,所以直接使用apt命令就可以安装。使用命令:aptapt-getin ... [详细]
  • 如何部署Zabbix监控实现监测和报警机制
    这篇文章的知识点包括:Zabbix的安装部署、Zabbix监控的实现以及Zabbix报警机制的实现,阅读完整文相信大家对Zabbix监控的使用有了一定的认识。Zabb ... [详细]
  • 无损压缩算法专题——LZSS算法实现
    本文介绍了基于无损压缩算法专题的LZSS算法实现。通过Python和C两种语言的代码实现了对任意文件的压缩和解压功能。详细介绍了LZSS算法的原理和实现过程,以及代码中的注释。 ... [详细]
  • 本文介绍了在Windows环境下如何配置php+apache环境,包括下载php7和apache2.4、安装vc2015运行时环境、启动php7和apache2.4等步骤。希望对需要搭建php7环境的读者有一定的参考价值。摘要长度为169字。 ... [详细]
  • 本文介绍了将mysql从5.6.15升级到5.7.15的详细步骤,包括关闭访问、备份旧库、备份权限、配置文件备份、关闭旧数据库、安装二进制、替换配置文件以及启动新数据库等操作。 ... [详细]
author-avatar
345877103_b54cd7
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有