1
votes

enter image description hereI'm beginner python code, and not good at english.

my laptop window 10 pro, python version 3.6 mysql commmunity server version 8.0.12

problem

headfirst python

this is the code

mysql -u root -p
mysql>create database vsearchlogDB;
mysql>grant all on vsearchlogDB.* to 'vsearch' identified by 'vsearchpasswd';

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by 'vsearchpasswd'' at line 1

2
create user vsearchlogDB identified by 'vsearchpasswd'; not just create vsearchlogDB; - Mihai

2 Answers

2
votes

it should be grant all privileges, not just all the username should also have the host pointer like `vserach'@'%'

grant all privileges on vsearchlogDB.* to 'vsearch'@'%' identified by 'vsearchpasswd';

is more like it

EDIT: I'm blind and totally ignored the "8.0" part. On 8.0 this should look like:

create user 'vsearch'@'%' identified by 'vsearchpasswd';
grant all privileges on vsearchlogDB.* to 'vsearch'@'%'; //(Don't forget the ';')
1
votes

Please try this code:

create user 'vsearch' identified by 'vsearchpasswd';

grant all on vsearchlogDB.* to vsearch;