I done messed something up.
I am working on a Node / Express app that is using the Sequelize ORM to write to a local mysql DB for development. I loaded it up this morning, and it was fine. At some point in working today, I attempted to reset my mysql root password (for unrelated reasons). I did so, then attempted to restart the node server for my app, and it now fails to load. When running
node app.js
I get
TypeError: Uncaught, unspecified "error" event.
at TypeError (<anonymous>)
at EventEmitter.emit (events.js:74:15)
at module.exports.finish (/Users/DrHall/Desktop/gitRepos/CRPinit/node_modules/sequelize/lib/query-chainer.js:142:30)
at exec (/Users/DrHall/Desktop/gitRepos/CRPinit/node_modules/sequelize/lib/query-chainer.js:96:16)
at onError (/Users/DrHall/Desktop/gitRepos/CRPinit/node_modules/sequelize/lib/query-chainer.js:72:11)
at EventEmitter.emit (events.js:95:17)
at null.<anonymous> (/Users/DrHall/Desktop/gitRepos/CRPinit/node_modules/sequelize/lib/dao-factory.js:299:42)
at EventEmitter.emit (events.js:95:17)
at null.<anonymous> (/Users/DrHall/Desktop/gitRepos/CRPinit/node_modules/sequelize/lib/query-interface.js:224:17)
at EventEmitter.emit (events.js:98:17)
I have found other people reporting this error message, but its vague enough that it has been for different reasons that the spesific failures I am getting. I am too new at this whole process to know what I did in the process of reset my root password that is not making Sequelize fail to load.
Mysql root loads fine with the new password. The app does not use the root user, it uses a separate user, who can also log in fine.
Any ideas what I did wrong?
Extra info to address questions asked:
TO reset the password I did use '-skip-grant-tables'. Running grep i saw that mysql was still running with that command, so I killed it and started it up again. Running ps -Af | grep mysql I get
501 7563 1 0 4:31PM ttys000 0:00.02 /bin/sh /usr/local/Cellar/mysql/5.6.14/bin/mysqld_safe --datadir=/usr/local/var/mysql --pid-file=/usr/local/var/mysql/Lil-Coder.pid
501 7662 7563 0 4:31PM ttys000 0:00.44 /usr/local/Cellar/mysql/5.6.14/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.6.14 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql/5.6.14/lib/plugin --log-error=/usr/local/var/mysql/Lil-Coder.err --pid-file=/usr/local/var/mysql/Lil-Coder.pid
501 7677 7460 0 4:32PM ttys000 0:00.00 grep mysql
Which seems right? But the same error on trying to boot node.
I'm just going to file this one under 'W' for WTF. In the end what fixed it was basically nothing. I was connecting to the MySQL DB via Sequelize via:
sequelize = new Sequelize(config.database, config.username, config.password, {
dialect: 'mysql',
port: 3306
}),
with config being an external file I was requiring. I replaced all of the config. variables with the actual strings from the config file (copy/paste) and it worked. Copied them back, and it still worked. It's all voodoo to me.
Related
I'm migrating a database from MySQL to Postgres. This question has been very helpful. When running the python manage.py dumpdata --exclude contenttypes --indent=4 --natural-foreign > everything_else.json to create a json fixture the connection is aborted by the database server. All other steps have been successful.
The MySQL database is hosted on RDS and the connection is aborted at the same point in the file each time I try to run this (file size is always 12288 bytes). Logs from the RDS instance state the problem as follows (db, user and host changed to dummy values):
[Note] Aborted connection 600000 to db: 'mydb' user: 'myUsername' host: '127.0.0.1' (Got an error writing communication packets)
In the terminal the message is simply killed.
Why would this error be happening and how can I create this json fixture?
Update
To test for timeout issues I've followed the advice in this post to change default timeout values. This has no effect on the problem.
I've also tried modifying the DB instance to one with more memory etc. This had no effect.
Further update
I didn't get to the bottom of this but instead took a different route and used AWS database migration service (DMS). There's a good walkthrough for this here. For my small ~5GB database the migration process took 5 minutes with negligible costs on the smallest DMS instance.
Up until today MYSQL was working OK for months with 2 MAMP Drupal localhost builds.
But now MYSQL no longer loads.
When opening MAMP the Apache Server starts,
whereas the MYSQL Server does not start.
This means the "Open WebStart page" option is greyed over and the Drupal path that would normally load the site just displays an error.
Using Terminal, if I run:
which mysql
the response is:
/Applications/MAMP/Library/bin/mysql
But if I try to login into MYSQL via Terminal:
mysql -u (myuser) -p
I am prompted for the password, but after entering correct password I receive:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/Applications/MAMP/tmp/mysql/mysql.sock' (2)
I checked that path, and there is no mysql.sock file there. In that directory there is just one file titled .dummy that has no content in it.
Some forums relating to the same error suggest I check and stop any other running MYSQL instances, but I don't appear to have any.
For example I ran:
ps -ef | grep mysql
And I just receive this:
501 11212 10699 0 12:31pm ttys000 0:00.00 grep mysql
I don't entirely understand that response, but it looks like there is nothing running that I can 'kill'.
Also, if I try things like:
sudo service mysql start
I am prompted for my Mac user password, which I enter, but I am then given the error:
sudo: service: command not found
Any help here would be greatly appreciated.
EDIT: I ran:
mysqld
And received a lot of information! Too long to paste here,
but some things I noticed were:
2019-02-14T03:01:33.211495Z 0 [Note] --secure-file-priv is set to NULL.
Operations related to importing and exporting data are disabled
I don't know how to address the above, but it sounds like it's not helping the situation?
Further on from there, the first 'warning' from the list was:
[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
I followed that advice and ran:
mysql_upgrade
and received this error:
mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2) while connecting to the MySQL server
Upgrade process encountered error and will not continue.
Any ideas as to how to fix that?
Some other errors I noticed are:
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
[ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
[ERROR] Aborting
followed by a lot of lines of "shutting down plugin...(various)..." that ended in:
mysqld: Shutdown complete
Again, I am completely lost here?
After hours of trying out suggestions from various forum threads, such as:
Creating my.cnf files; or
Adjusting the MAMP php.ini file with extra code, or
Reinstalling MAMP again,or
Dumping the "ib_logfile.." files from the MAMP/db/mysql57 directory,
The only thing that finally resolved this for me was:
I suddenly remembered I copied all my working files to a backup.
so I checked the backup directories for MAMP/db/mysql57 and noticed there was a lot of content in there that for some reason was now missing from my live version,
so I deleted everything in the current MAMP/db/mysql57 directory and pasted all the backup items in.
Suddenly MAMP's MYSQL server lights up, the Startup page auto loads into my browser and I can run drush commands in my CLI and load the Drupal CMS again.
Happy Days!
I have recently installed MySQL directly from the website (mysql-5.7.9-osx10.10-x86_64.dmg) and I have run into a great deal of difficulty that started with trying to change the given password. The error that was returned was:
[Warning] Using a password on the command line interface can be
insecure. mysqladmin: connect to server at 'localhost' failed error:
Can't connect to local MySQL server through socket '/tmp/mysql.sock
(2)' Check that mysqld is running and that the socket:
'/tmp/mysql.sock' exists!
From here I attempted to find the "usr" folder (hidden files are showing) or even anything that closely resembles MySQL anywhere on my computer and got nothing except for installation .dmg files.
I know that MySQL was installed because it is now able to be started and stopped in the System Preferences pane, but clearly none of my commands are working and I keep getting this error no matter what I do:
mysql: command not found
Can someone give me some clue as to what I am missing? I've become fairly desperate and can't figure out what I am doing wrong. I am running El Capitan.
Well, if you're saying that MySQL is running, you can try looking for it via terminal command like this:
ps aux | grep mysql
which should give something like
12345 ... 5 Apr16 9:09.32 /usr/local/Cellar/mysql/5.6.17/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.6.17 --datadir=/usr/local/var/mysql --bind-address=127.0.0.1
so basedir and datadir is probably the most valuable outputs here (please note that your path most likely will be different).
On top of it, in order to get mysql command running through terminal you have two options
Create simulink from mysql's basedir into your /usr/local/bin directory
ln -s /usr/local/Cellar/mysql/5.6.17/bin/mysql /usr/local/bin/mysql
Add mysql's basedir/bin to your path (need to add this to your ~/.bashrc to make it persistent)
export PATH=/usr/local/Cellar/mysql/5.6.17/bin/:$PATH
New terminal tab is required for these changes to catch up.
Cheers.
I was working on a MySQL Fabric installation, and had been working with disable_authentication set to yes:
...
[protocol.xmlrpc]
address = 0.0.0.0:32274
threads = 5
user = admin
password = hunter2
disable_authentication = yes
realm = MySQL Fabric
ssl_ca =
ssl_cert =
ssl_key =
...
I set it to 'no', and ran mysqlfabric manage stop then mysqlfabric manage start --daemonize. The client app broke, so I set disable_authentication back to 'yes' and ran mysqlfabric stop again to restart it, but I got:
Permission denied.
I looked through the documentation, both locally and at online, and haven't seen any way to pass a username and password to the mysqlfabric utility. I tried -u -p as in MySQL and --user and --password, to no avail. The latter gives
mysqlfabric: error: no such option: --password
Which seems to suggest that --user is a valid option, but I tried --pass and -p with no success.
I could probably just kill the process, but I'd like to know how to cleanly restart the server when authentication is enabled.
After plumbing around in the code for mysqlfabric, I noticed that it looked like the mysqlfabric utility was re-reading the newly-modified config file, seeing that disable_authentication was now set to 'yes', and thus clearing out any credentials, even if I specified them on the command line.
As far as I can tell, the running mysqlfabric instance still had credentials enabled, so when it was presented with the cleared-out credentials, it denied permission.
The solution was to change the config file back to disable_authentication = no, stop the server, then edit the config file to disable authentication, and start back up.
Takeway lesson:
Don't modify the Fabric configuration file while it's running, make sure to stop the server, edit the config, and then start it back up.
While I was at it, it seems that if you do need to specify a username/password, the command is indeed:
mysqlfabric manage stop --user=<username>
It will then prompt for a password.
I have been developing my application from a dev sandbox and want to push the reference data from "dev" to "prod". I thought I'd succeeded by executing the following commands:
On my OSX dev machine:
cbbackup http://127.0.0.1:8091 ~/couchbase-reference-data -b reference_data -u username -p password
Again on my OSX dev machine:
cbrestore ~/couchbase-reference-data http://prod.server.com:8091/ -u password -p password
Now when I go to the admin console on production I see this:
Looks good at this point. However, if I click any of the "Edit Document" button things go tragically wrong:
Any help would be GREATLY appreciated!
UPDATE:
I've noticed that now when I run the cbrestore command I get the following errors:
2013-06-03 16:53:48,295: s0 error: CBSink.connect() for send: error: SASL auth exception: aws.internal-ip.com:11210, user: reference_data
2013-06-03 16:53:48,295: s0 error: async operation: error: SASL auth exception: aws.internal-ip.com:11210, user: reference_data on sink: http://prod.server.com:8091/(reference_data#127.0.0.1:8091)
error: SASL auth exception: aws.internal-ip.com:11210, user: reference_data
This reminds me that I think what I did was copy the ~/couchbase-reference-data directory to the production environment and then ran the cbrestore from there. I have just done that now and get the following confirmation:
[####################] 100.0% (189/189 msgs)
bucket: reference_data, msgs transferred...
: total | last | per sec
batch : 1 | 1 | 16.1
byte : 36394 | 36394 | 585781.0
msg : 189 | 189 | 3042.1
done
After this process, however, the problem still exists in the same manner as described before.
UPDATE 2
I decided to delete, re-create, and re-import the bucket on production. All steps completed and I still have the same error but I'm wondering if the LOG file has any interesting information in it:
The things that stand out as interesting to me are:
The loading time was "0 seconds" ... as much as I'd like to believe that it may be a little too quick? It's not a ton of data but still.
The "module code" is named 'ns_memecached001' ... is that an issue? Memcached? I did double check that I set this up as a couchbase bucket. It is.
It seems as if your destination server is not OS X, but e.g. Linux. Here you have to use the "rehash"-extra-option.
Backup your data on your dev machine (using cbbackup)
Copy the data to your prod machine
Restore the data with the -x rehash=1 flag: (using cbrestore -x rehash=1)