Can anyone help get this command working again? This cmd used to work in the putty console -
sudo mysql-create-db-and-user dbuserhere dbnamehere passwordhere
This error now appears -
ERROR 1064 (42000) at line 1: 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 'passwordhere'' at line 1
I have MySQL version 8.0.28 on Ubuntu 20.04.4 LTS.
The database is created but I can’t connect to it using the username and password used in the cmd.
I can only guess it stopped working after I did sudo apt update
and sudo apt upgrade
.
This is the error in /var/log/mysql/error.log
2022-05-26T04:50:06.754109Z 21 [Warning] [MY-013360] [Server] Plugin sha256_password reported: ''sha256_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
I managed to do what I want by using these commands -
CREATE DATABASE dbnamehere;
CREATE USER 'dbuserhere'@'localhost' IDENTIFIED WITH mysql_native_password BY 'passwordhere';
GRANT ALL on dbnamehere.* TO 'dbuserhere'@'localhost';
Hi @twc8ac35a8636,
Is mysql-create-db-and-user some kind of a custom script?
What I think happened is that with apt update
and apt upgrade
you’ve updated a Minor version or a NOT so minor version on MySQL which has a different syntax for the CREATE statement being used in the mysql-create-db-and-user script.
What I’ll recommend is to find the said script and update it with the new Syntax.
Are you using the NPM module? https://www.npmjs.com/package/mysql-create-db-and-user
that’s a script you invoke, post your script WITHOUT credentials here.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.