import pymysql db = pymysql.connect(host = 'localhost',user = 'root',password =
'asdfgh',port = 3306) cursor = db.cursor() cursor.execute('SELECT VERSION()')
data = cursor.fetchone() print('database version:',data) cursor.execute('CREATE
DATABASE spiders DEFAULT CHARACTER SET utf8') db.close()


resolvent :

1. open cmd Command line window , input cd C:\Program Files (x86)\MySQL\MySQL Server
5.7\bin, Enter the directory .( This is yours mysql Under the directory of bin folder )

2. input mysql -hlocalhost -uroot -p, Enter and enter the password , Then connect mysql

3. input ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY
' Your password '; Press enter and the modification is successful



Finally, run the code again to appear

database version: ('8.0.11',)