3

I meet some problems in mysql,

OS:centos7

MySQL:mysql Ver 8.0.19 for Linux on x86_64 (MySQL Community Server - GPL)

MySQL Shell:mysql-shell-8.0.23-1.el7.x86_64

I can use ( mysql -uroot -p ) to connect mysql,but I can't use mysql shell to connect mysql.

My root password is right, How to solve this?

enter image description here

enter image description here

GAD3R
  • 4,317
  • 1
  • 23
  • 34
Ryan Gee
  • 41
  • 6
  • You need to allow access to user to connect to your db https://stackoverflow.com/questions/14779104/mysql-how-to-allow-remote-connection-to-mysql – kaan Apr 02 '21 at 07:52
  • Did you try without sh? mysql -uroot – Thallius Apr 02 '21 at 08:26
  • Please [edit] your question to include the content of the `mysql.user` table (without the `*_priv` columns). – Progman Apr 02 '21 at 11:49

2 Answers2

1

I solved this problem ,I don't have the Permission in root, so I use

create user root@"%" identified by '***';  
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Ryan Gee
  • 41
  • 6
0

This worked for me for MySQL 5.7 on Ubuntu 18.04:

sudo mysqlsh -u root --no-password --socket /var/run/mysqld/mysqld.sock
Afanasii Kurakin
  • 3,330
  • 2
  • 24
  • 26