I have pulled an existing project and am trying to get it to run locally (in Cloud9 IDE). However, I'm running into problems with connecting with the MySQL db.
There are some environment variables I believe to have set correctly. The password is kept empty, following the Cloud9 instructions.
I used mysql -u root -p and can then successfully access the MySQL db without submitting a password.
DB_NAME=c9
DB_USER=$C9_USER
DB_PASS=
DB_HOST=127.0.0.1
DB_DRIVER=mysql
DB_PORT=3306
When I now run npm run rollback or npm run migrate or anything else with the database, I receive an error:
Error: ER_ACCESS_DENIED_ERROR: Access denied for user
'$C9_USER'#'localhost' (using password: NO)
I then replaced $C9_USER in the environment variables with root, and ran npm run migrate. This time it worked and it didn't produce an error.
But I'm new to all this and not really sure if it is actually okay what I did. According to the Cloud9 manual I should be working with $C9_USER, so why is that not working for me? Also when I now run npm run rollback I now get another error (but maybe unrelated?):
Error: ER_ERROR_ON_RENAME: Error on rename of './c9/#sql-1827_4a' to
'./c9/sent_emails' (errno: 150)
I found out the problem. When I replace $C9_USER with the actual username, it works. The Cloud9 manual seems to suggest otherwise, but I needed to enter the actual values and not refer to the environment variable.
Related
I am trying to deploy a test python app on digitalocean for the first time. (Ubuntu 16.04, uWSGI, NGINX). I've added a user and granted all privileges (and triple checked privileges). When I try and run the app, none of my tables get created and when I check the mysql error logs I see: "Access denied for user 'user'#'localhost' (using password: NO)"
The app itself runs fine without errors. It's just that none of my tables get created so when I enter a flask route that has a database query I get the 500 error
In my uWSGI, when defining database, I have the following:
ENVIRONMENT=DATABASE_URL=mysql://user:userpw#localhost:3306/databasename
command i ran to install mysql:
sudo apt-get install mysql-server
What might I be missing? Its driving me crazy...
I followed this tutorial very carefully, but changed postgres to mysql:
https://github.com/CristianoYL/Tutorials/blob/master/How%20To%20Deploy%20Python%20App%20Using%20uWSGI%20And%20Nginx.md
No mention so far, but how about FLUSH PRIVILEGES?
I'm also assuming there is no password. Password "NO" (as in none provided). I would look at the users table to see if they are set or not. It might be easier to test from the mysql cli vs. HTTP 500 errors :)
I tried this as a comment first, but it said I need 50 rep. I'll edit this post until I figure out a better way...
I had mysql already installed in my system and I uninstalled it because it was not running successfully.
Now when I installed a new version of mysql, the server starts and stops successfully. But it still accepts the password of my old mysql.
If I try to change the password, which I need to because it says my old password has expired when I try to connect it to workbench, it gives me the following error:
File './mysql/user.MYD' not found (Errcode: 2 - No such file or directory)
I also tried running this command:
mysql -uroot -p
It accepts my old password and then if I further run any other command, example
mysql> USE mysql;
It asks me to reset the password and when I do it again gives me the above error
If you've trashed your MySQL system tables you'll need to recreate them with the mysql_install_db command-line tool or something equivalent. This is done while the server process is stopped and should initialize everything correctly.
I am trying to use wp-deploy (which makes use of Capistrano) to deploy my Wordpress site to a Digital Ocean Droplet. I think I have everything configured properly but when I try to run the ...
bundle exec cap staging db:pull
... I get an error
SSHKit::Runner::ExecuteError: Exception while executing as sudousername#xxx.xxx.xxx.xxx: wp exit status: 127
(username and IP changed for privacy of course). So I SSH into my droplet and try to just connect to mysql using
mysql -u sudousername -p
and get the following error...
ERROR 1045 (28000): Access denied for user 'sudousername'#'localhost' (using password: YES)
I think this is because sudousername belongs to the sudo group and that group doesn't have permission to manage the DB?
I was hoping to find one of two solutions:
Grant the appropriate permissions to sudousername so it can do what it needs to on the DB
Pass along a second username and pass with Capistrano for the DB user (I created a user with phpmyadmin when I setup the database for Wordpress). The thought here being that when Capistrano is already SSH'd in and trying to perform functions on the DB it would use this other username and password.
I have looked for a solution for a couple hours now but I am a server n00b and haven't been able to find anything (and probably not sure what I am looking for).
Is anyone able to help? Thanks in advance!
I have figured out what the issue was. wp-deploy was using my sudo users credentials to SSH in and execute some shell commands. One of which was trying to use the WP Cli tool which I didn't have installed. Once I installed the WP Cli tool the scripts SSH'd in and ran wp db export and does so as the correct DB user. Thanks to #JuanTomas for helping me narrow that down.
For those that are having the same issue I also had to grant my DB user permissions for "LOCK TABLES'. Also, if you are using Wordpress 4.4+ you need WP Cli version 0.24 minimum or there will be compatibility issues. Use wp --info to check what version you have.
I am installing MySQL on Windows with the following command line:
MySQLInstallerConsole community install -silent server;5.7.12;x64:*:type=config;servertype=Server;openfirewall=true;generallog=true;serverid=3306;enable_tcpip=true;port=3306;rootpasswd=%1;installdir="C:\MySQL\MySQLServer-5.7":type=user;username=foo;password=bar;role=DBManager
This line is contained in a script, and I pass in the root password from a random generated string. However, I am getting an access denied for 'root'#'localhost' when trying to access the server via
mysql -u root -p
(and providing the password)
I can not find any issues with the parameters for MySQLInstallerConsole. Connecting as user foo even works, but I really need the root password to work.
Any ideas?
I finally figured out what the issue was: the system had a MySQL server installed before. The service and binaries had all been removed, but there still was a MySQL data directory in the default location (somewhere in %ProgramData%"). This seems to cause to make the installer console fail to finish the new installation WITH a different root password.
Removing the old data directory and re-running the installer command line as stated in the original question (without any changes) resulted in successful installation.
Just for context:
I'm using Capistrano for deploying my WordPress site. specifically this one: https://github.com/markjquith/WP-Stack
You basically install this on your dev machine, set up SSH on your local and remote machines so that it can access whatever it needs to access via the Capistrano, give it the database credentials used by the staging and production sites and you're good to go.
deployment runs fine. syncing databases is where my problem is. specifically when the Capistrano runs the following code:
mysqldump -u livesiteuser --result-file=/tmp/wpstack-26754.sql -h localhost -plivesiteuserpass livesitedbname
which results in:
mysqldump: Got error: 1045: Access denied for user 'livesiteuser'#'localhost' (using password: YES) when trying to connect
BUT, when I run this same code myself on the remote server (where the production is at), it works.
I'm really not sure what I'm doing wrong. I've made livesiteuser have grant access to everything. Oh yeah, using mysql root does the same thing.
Solution:
if your password is mypa$$wor& <-- contains special characters
you need to type it as mypa\$\$wor\&
Special characters need to be escaped with the backslash, since the terminal interprets special characters as parameters of the command.
I had the same issue. Including the port number using --port=3316 solved the problem.