MYSQL 8.0 - unsupported redo log format - php

I have recently updated mysql that was located under my xampp folder, and i've got the following errors, reporting from the log file :
2018-04-19T12:59:19.667059Z 0 [System] [MY-010116] [Server] C:\xampp\mysql\bin\mysqld.exe (mysqld 8.0.11) starting as process 9324
2018-04-19T12:59:20.025280Z 1 [ERROR] [MY-013090] [InnoDB] InnoDB: Unsupported redo log format (0). The redo log was created before MySQL 5.7.9
2018-04-19T12:59:20.026140Z 1 [ERROR] [MY-012930] [InnoDB] InnoDB: Plugin initialization aborted with error Generic error.
2018-04-19T12:59:20.229069Z 1 [ERROR] [MY-011013] [Server] Failed to initialize DD Storage Engine.
2018-04-19T12:59:20.230803Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2018-04-19T12:59:20.231371Z 0 [ERROR] [MY-010119] [Server] Aborting
2018-04-19T12:59:20.233136Z 0 [System] [MY-010910] [Server] C:\xampp\mysql\bin\mysqld.exe: Shutdown complete (mysqld 8.0.11) MySQL Community Server - GPL.
I have been told if updating your mysql, you should comment out the deprecated configs that are located in your my.ini, but i had no idea what to comment out, so i left it as it is.
Any idea what causes this?

If you have already installed MySQL and did not perform a slow shutdown using the
innodb_fast_shutdown
Flag, simply go to your MySQL directory
/var/lib/mysql/
And remove the log files (Do not do this if you need the table data in your database until you have backed up your database):
ib_logfile0
ib_logfile1
Back them up before if you need them again.

Docker users
I faced with the same error while using dockerized mariaDB.
The solution was:
remove the docker image:
docker image ls
docker rmi imagename
remove the volume:
docker volume ls
docker volume rm yourvolume
remove the container:
docker ps -a
docker rm yourcontainer
Then:
docker-compose up
Windows 10 Users
Also in windows if you want to remove the log files as it was suggested earlier:
The ib_logfiles are in
C:\ProgramData\MySQL\MySQL Server x.x\Data

Mac OS X Users
The ib_logfiles are here
rm /usr/local/var/mysql/ib_logfile*

In my case, I have deleted the complete folder /var/lib/mysql and restarted the mysql service and it worked...
rm -rf /var/lib/mysql
Note: You may loose your data if you delete that folder

Related

Laravel Sail starting error related to MySQL on Ububtu 22

I added Sail to a current Laravel project
composer require laravel/sail --dev
php artisan sail:install
but when I run ./vendor/bin/sail up I get MySQL error:
:~/work/dashboard$ ./vendor/bin/sail up
[+] Running 3/3
⠿ Network dashboard_sail Created 0.1s
⠿ Container dashboard-mysql-1 Created 2.8s
⠿ Container dashboard-laravel.test-1 Created 1.1s
Attaching to dashboard-laravel.test-1, dashboard-mysql-1
dashboard-mysql-1 | [Entrypoint] MySQL Docker Image 8.0.31-1.2.10-server
dashboard-mysql-1 | [Entrypoint] Starting MySQL 8.0.31-1.2.10-server
dashboard-mysql-1 | 2022-10-17T10:10:38.740784Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
dashboard-mysql-1 | 2022-10-17T10:10:38.741647Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31) starting as process 1
dashboard-mysql-1 | 2022-10-17T10:10:38.750935Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
dashboard-mysql-1 | 2022-10-17T10:10:38.795221Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
dashboard-mysql-1 | 2022-10-17T10:10:39.287522Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
dashboard-mysql-1 | 2022-10-17T10:10:39.287656Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
dashboard-mysql-1 | 2022-10-17T10:10:39.287668Z 0 [ERROR] [MY-010119] [Server] Aborting
dashboard-mysql-1 | 2022-10-17T10:10:39.287971Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.
dashboard-laravel.test-1 | 2022-10-17 10:10:41,882 INFO Set uid to user 0 succeeded
dashboard-laravel.test-1 | 2022-10-17 10:10:41,883 INFO supervisord started with pid 1
dashboard-laravel.test-1 | 2022-10-17 10:10:42,885 INFO spawned: 'php' with pid 16
dashboard-laravel.test-1 |
dashboard-laravel.test-1 | Illuminate\Database\QueryException
dashboard-laravel.test-1 |
dashboard-laravel.test-1 | SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for mysql failed: Temporary failure in name resolution (SQL: select * from information_schema.tables where table_schema = dashboard and table_name = report_errors and table_type = 'BASE TABLE')
.env
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=dashboard
DB_USERNAME=sail
DB_PASSWORD=password
and when I open http://localhost I get This site can’t be reached. How to fix this?
[Update]
I run docker ps -a and fount 2 containers: onr for sail and the other for MySQL.
f20cf9718056 sail-8.1/app ... dashboard-laravel.test-1
b7007d3a061c mysql/mysql-server:8.0 ... dashboard-mysql-1
I run docker-compose start and both containers are running.
docker-compose start
Starting mysql ... done
Starting laravel.test ... done
Now I try to run ./vendor/bin/sail up But I get
SQLSTATE[HY000] [2002] Connection refused
I run docker ps but the MySQL container exit
f20cf9718056 sail-8.1/app "start-container" About an hour ago Up 2 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:5173->5173/tcp, :::5173->5173/tcp, 8000/tcp dashboard-laravel.test-1
MySQL Logs
docker logs dashboard-mysql-1
[Entrypoint] MySQL Docker Image 8.0.31-1.2.10-server
[Entrypoint] Starting MySQL 8.0.31-1.2.10-server
2022-10-17T14:01:13.615764Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
2022-10-17T14:01:13.616826Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31) starting as process 1
2022-10-17T14:01:13.627454Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-10-17T14:01:13.832319Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-10-17T14:01:14.321686Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-10-17T14:01:14.321863Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-10-17T14:01:14.321881Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-10-17T14:01:14.322186Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.
[Entrypoint] MySQL Docker Image 8.0.31-1.2.10-server
[Entrypoint] Starting MySQL 8.0.31-1.2.10-server
2022-10-17T14:10:37.311446Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
2022-10-17T14:10:37.312494Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31) starting as process 1
2022-10-17T14:10:37.331341Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-10-17T14:10:37.442677Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-10-17T14:10:37.932648Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-10-17T14:10:37.932756Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-10-17T14:10:37.932772Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-10-17T14:10:37.933079Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.
[Entrypoint] MySQL Docker Image 8.0.31-1.2.10-server
[Entrypoint] Starting MySQL 8.0.31-1.2.10-server
2022-10-17T14:10:47.381949Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
2022-10-17T14:10:47.382974Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31) starting as process 1
2022-10-17T14:10:47.389572Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-10-17T14:10:47.411196Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-10-17T14:10:47.901979Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-10-17T14:10:47.902111Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-10-17T14:10:47.902128Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-10-17T14:10:47.902444Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.
[Entrypoint] MySQL Docker Image 8.0.31-1.2.10-server
[Entrypoint] Starting MySQL 8.0.31-1.2.10-server
2022-10-17T15:04:03.773574Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
2022-10-17T15:04:03.774621Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31) starting as process 1
2022-10-17T15:04:03.788273Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-10-17T15:04:03.852948Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-10-17T15:04:04.341269Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-10-17T15:04:04.341410Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-10-17T15:04:04.341425Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-10-17T15:04:04.341726Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.
I did not use Laravel Sail I prefer to make my own docker and docker-compose files so let me get you a bit closer to the error. Error : Failed to connect to server: php_network_getaddresses: getaddrinfo failed this error can occur due to two reasons.
there might be an issue with your DNS settings
PHP may not be able to get the network addresses for a given
host/domain name.
so you need to make sure the service name in your docker file for MYSQL is used in your Laravel .env file as a DB_HOST. and one more thing Laravel is trying to make a select statement somehow outside of the container so you got the mentioned error above in case you took care of the 2 points I mentioned above.

after update Ubuntu to 16.04 and re-install mysql 5.7, FF-browser doesn't display any query results

problem is: after re-install mysql 5.7, FF-browser and Chrome-browser doesn't display any query results. I tested with standart querys from mysql-manual:
$link = mysqli_connect("localhost", "root", "cydb4tsa", "RedGround");
if (mysqli_query($link, "CREATE TEMPORARY TABLE myCity LIKE City") === TRUE) {
echo "Table myCity successfully created.";
}
please understand: i'm not an administrator, not used to handle such problems every day.
My project is in serious threat, because I upgraded to Ubuntu 16.04 with mysql-server-5.7, result after all is that no query result is displayed in FF-browser or Chrome ... I miss feedback on my call for help (I included step by step report of the problem) in 'ask Ubuntu'.
i tried analyzing mysql_errors:
cat error.log | grep 'Warning'
sebu#sebu-Inspiron-3437:/var/log/mysql$ cat error.log | grep 'Warning'
2017-01-20T03:25:22.334192Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2017-01-20T03:25:22.334288Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2017-01-20T03:25:22.650055Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-01-20T03:25:25.671903Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2017-01-20T22:29:11.912552Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2017-01-20T22:29:11.912644Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2017-01-20T22:29:12.294907Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-01-20T22:29:15.527007Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2017-01-20T22:35:01.057707Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2017-01-20T22:35:01.057815Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2017-01-20T22:35:03.952763Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-01-20T22:35:10.096231Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
/var/log/mysql# ulimit -n 5000
also done:
mysql> SET GLOBAL table_open_cache = 2000;
no effect and varables went back to old value after reboot
i can provide some more info now:
i search for updates for Ubuntu 16.04 and following happened:
after install
report was sent
yes i modified link-source from mysql.cnf but i disable this modifications because they caused an error-msg.
please release this report from hold status, or give me info where is the right place for this topic!
after the newest update even the command-line function cause an error-msg,
befor this part was working normaly.
~$ mysql -u root -pcydb4tsa RedGround
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2)
note) After updating Ubuntu again (new ubuntu kernel) the command line mysql> run without error. The newerly update finished successfully, but i still get an empty screen on my web-browser after running test scripts :-(
maybe good to know:
phpMyAdmin works without any problems. Why and How phpMyAdmin can properly connect my DB ????

Mysql : daemon doesn't start

Few hours ago, Mysql shuts down on my production server. I've tried to restart it with 'service mysqld restart' as usual (I'm on a centos), but:
MySQL Daemon failed to start.
In my log file, I have :
151125 10:53:10 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
151125 10:53:10 InnoDB: Initializing buffer pool, size = 8.0M
151125 10:53:10 InnoDB: Completed initialization of buffer pool
151125 10:53:10 InnoDB: Started; log sequence number 0 6283559
01:53:10 UTC - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.
key_buffer_size=8384512
read_buffer_size=131072
max_used_connections=0
max_threads=151
thread_count=0
connection_count=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 338336 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0 thread_stack 0x40000
/usr/libexec/mysqld(my_print_stacktrace+0x29) [0x8509b9]
/usr/libexec/mysqld(handle_fatal_signal+0x483) [0x6a3ef3]
/lib64/libpthread.so.0() [0x3e59e0f790]
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
151125 10:53:10 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
I am losing potential clients every second, so I will appreciate your help, thank you
EDIT
Problem solved ! My partition was full :
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 15G 15G 0M 100% /
I've deleted some useless backups/logs files and restart mysql.
Thank you

having an issue compiling php on ubuntu using apt-src

i have been trying to compile php with apt-src and after about 20 minutes in one of the php tests fails trying to connect to mysql and itacked the script making the error here is the error from setup-mysql.sh
150419 17:48:11 [Warning] Can't create test file /home/php-build/php5-5.5.9+dfsg/mysql_db/orangehrm-Inspiron-N5010.lower-test
150419 17:48:11 [Warning] Can't create test file /home/php-build/php5-5.5.9+dfsg/mysql_db/orangehrm-Inspiron-N5010.lower-test
ERROR: 1005 Can't create table 'db' (errno: 13)
150419 17:48:11 [ERROR] Aborting
150419 17:48:11 [Note] /usr/sbin/mysqld: Shutdown complete
Installation of system tables failed! Examine the logs in
/home/php-build/php5-5.5.9+dfsg/mysql_db for more information.
You can try to start the mysqld daemon with:
shell> /usr/sbin/mysqld --skip-grant &
and use the command line tool /usr/bin/mysql
to connect to the mysql database and look at the grant tables:
shell> /usr/bin/mysql -u root mysql
mysql> show tables
Try 'mysqld --help' if you have problems with paths. Using --log
gives you a log in /home/php-build/php5-5.5.9+dfsg/mysql_db that may be helpful.
Please consult the MySQL manual section
'Problems running mysql_install_db', and the manual section that
describes problems on your OS. Another information source are the
MySQL email archives available at http://lists.mysql.com/.
Please check all of the above before submitting a bug report
at http://bugs.mysql.com/
im running the compilation according to this
im running everything as root
note im compiling just the php and if there is a way to disable tests in php that would be grate.
In the source directory, open the rules file debian/rules.
Find the line RUN_TESTS = yes and comment it out like #RUN_TESTS = yes .
Then, tests won't run during the build.

Mongodb not working in windows 32bit [duplicate]

I am coming from riak and redis where I never had an issue with this services starting, or to interact.
This is a pervasive problem with mongo and am rather clueless. Restarting does not help.I am new to mongo.
mongo
MongoDB shell version: 2.2.1
connecting to: test
Fri Nov 9 16:44:06 Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:91
exception: connect failed
This is what I see in the logs.
now open)
Fri Nov 9 16:44:34 [conn47] end connection 10.29.16.208:5306 (1 connection now open)
Fri Nov 9 16:45:04 [initandlisten] connection accepted from 10.29.16.208:5307 #48 (2 connections now open)
Fri Nov 9 16:45:04 [conn48] end connection 10.29.16.208:5307 (1 connection now open)
Fri Nov 9 16:45:04 [initandlisten] connection accepted from 10.29.16.208:5308 #49 (2 connections now open)
Fri Nov 9 16:45:04 [conn49] end connection 10.29.16.208:5308 (1 connection now open)
Fri Nov 9 16:45:34 [initandlisten] connection accepted from 10.29.16.208:5316 #50 (2 connections now open)
Fri Nov 9 16:45:34 [conn50] end connection 10.29.16.208:5316 (1 connection now open)
Fri Nov 9 16:45:34 [initandlisten] connection accepted from 10.29.16.208:5317 #51 (2 connections now open)
Fri Nov 9 16:45:34 [conn51] end connection 10.29.16.208:5317 (1 connection now open)
Fri Nov 9 16:46:04 [initandlisten] connection accepted from 10.29.16.208:5320 #52 (2 connections now open)
Fri Nov 9 16:46:04 [conn52] end connection 10.29.16.208:5320 (1 connection now open)
Fri Nov 9 16:46:04 [initandlisten] connection accepted from 10.29.16.208:5321 #53 (2 connections now open)
Fri Nov 9 16:46:04 [conn53] end connection 10.29.16.208:5321 (1 conn
Normally this caused because you didn't start mongod process before you try starting mongo shell.
Start mongod server
mongod
Open another terminal window
Start mongo shell
mongo
Resolved.
This problem could be solved by the below mentioned 4 steps
1) Remove .lock file
sudo rm /var/lib/mongodb/mongod.lock
2) repair the mongodb
mongod -–repair
3) start the mongod server
sudo service mongod start
4) start the mongo client
mongo
For more details take a look at http://shakthydoss.com/error-couldnt-connect-to-server-127-0-0-127017-srcmongoshellmongo-js-exception-connect-failed/
http://shakthydoss.com/technical/error-couldnt-connect-to-server-127-0-0-127017-srcmongoshellmongo-js-exception-connect-failed/
This method only works if you want to repair your data files without preserving the original files
To find where you dbpath resides- vim /etc/mongodb.conf
check for option dbpath=
(I have dbpath=/var/lib/mongodb)
Default: /data/db/
Typical locations include: /srv/mongodb, /var/lib/mongodb or /opt/mongodb .
Replace the /var/lib/mongodb with your dbpath
sudo rm /var/lib/mongodb/mongod.lock
sudo mongod --dbpath /var/lib/mongodb/ --repair
sudo mongod --dbpath /var/lib/mongodb/ --journal
(Make sure that you leave you terminal running in which you have run above lines,
dont press 'Ctrl+c' or quit it.)
Type the command to start mongo now in another window.
Hope this works for you !
for those who want to repair your data files while preserving the original files
mongo recover
This error is what you would see if the mongo shell was not able to talk to the mongod server.
This could be because the address was wrong (host or IP) or that it was not running. One thing to note is the log trace provided does not cover the "Fri Nov 9 16:44:06" of your mongo timestamp.
Can you:
Provide the command line arguments (if any) used to start your
mongod process
Provide the log file activity from the mongod startup as well as
logs during the mongo shell startup attempt?
Confirm that your mongod process is being started on the same
machine as the mongo shell?
I am a windows user and I installed MongoDB in November 2018 and I didn't wanted to setup data/db directories. But after few days, when I open, got an error message:
MongoDB shell version v4.0.4
connecting to: mongodb://127.0.0.1:27017
2018-12-05T20:42:40.108+0530 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: No connection could be made because the target machine actively refused it. :
connect#src/mongo/shell/mongo.js:257:13
#(connect):1:6
exception: connect failed
Then I tried to fix using all of above answers and didn't worked. When I tried to run mongod it said
MongoDB starting : pid=12220 port=27017 dbpath=C:\data\db\ 64-bit host=bla
I tried to change the db path(to program files) through file system and also using cmd but those didnot worked.
Solution that worked for me is:
Opened the Task Manager (ctrl + shift + esc) -> Services tab and there was a MongoDB row with the status stopped. Then I right clicked and clicked start and everything working perfectly :).
MAC OS
Check status
brew services list
Something like:
Name Status User Plist
mongodb stopped
start it
brew services start mongodb
Try it again
mongo or mongo --port 27017
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: No connection could be made because the target machine actively refused it.
This error caused because Mongo Server been closed
Simple Follow these steps
Open Task Manager
Go to >Services
Find MongoDB
Right click and select Start
In my case:
First I open config file
sudo vi /etc/mongodb.conf
Comment IP and Port like this
#bind_ip = 127.0.0.1
#port = 27017
Then restart mongodb
sudo service mongodb restart
sudo service mongod restart
Finally, it's work :D
finn#Finn ~ $ mongo
MongoDB shell version: 2.4.9
connecting to: test
> exit
A little to late with the answer but I've encountered the same issue
Following are the steps which helped me.
Go to C:\
Create "data" folder
In "data" create "db" folder
open terminal (CMD) -> go to EX:"c:\MongoDB\Server\3.4\bin"
type in mongod => this will start mongo server (leave it opened)
Run using a GUI, EX "robomongo"
Or
open new terminal (CMD) -> go to EX:"c:\MongoDB\Server\3.4\bin"
type in "mongo" command
Make sure that your mongo is running.
I fixed this problem by trying to repair the mongodb, there I found that the directory required for the db to run was not created. It shows this error
Type: mongod, it will show the error
exception in initAndListen: 29 Data directory /data/db not found., terminating
Error happen because dbpath /data/db/ (default config) does not exist. You need to create data folder and set permission for it.
Then I create a folder on my system by the command
sudo mkdir -p /data/db/
and
sudo chown id -u /data/db
then I run the mongo again and it worked.
I face same issue after searching a lot I solve this by following :
sudo service mongodb stop
sudo rm /var/lib/mongodb/mongod.lock
sudo mongod --repair --dbpath /var/lib/mongodb
sudo mongod --fork --logpath /var/lib/mongodb/mongodb.log --dbpath /var/lib/mongodb
sudo service mongodb start
If all the above solution does not work: go to service (start>search>services) and start mongodb service. Then, in a cmd prompt, after going to bin, type :/>mongo
To connect with mongo we have to first start 'mongod' services.
following output you can see :
$ mongod
2017-03-05T00:31:39.055+0530 I CONTROL [initandlisten] MongoDB starting : pid=1481 port=27017 dbpath=/data/db 64-bit host=Prabhu-Nandans-Mac.local
2017-03-05T00:31:39.056+0530 I CONTROL [initandlisten] db version v3.4.2
2017-03-05T00:31:39.056+0530 I CONTROL [initandlisten] git version: 3f76e40c105fc223b3e5aac3e20dcd026b83b38b
2017-03-05T00:31:39.056+0530 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2k 26 Jan 2017
2017-03-05T00:31:39.056+0530 I CONTROL [initandlisten] allocator: system
2017-03-05T00:31:39.056+0530 I CONTROL [initandlisten] modules: none
2017-03-05T00:31:39.056+0530 I CONTROL [initandlisten] build environment:
2017-03-05T00:31:39.056+0530 I CONTROL [initandlisten] distarch: x86_64
2017-03-05T00:31:39.056+0530 I CONTROL [initandlisten] target_arch: x86_64
2017-03-05T00:31:39.056+0530 I CONTROL [initandlisten] options: {}
2017-03-05T00:31:39.056+0530 W - [initandlisten] Detected unclean shutdown - /data/db/mongod.lock is not empty.
2017-03-05T00:31:39.057+0530 I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2017-03-05T00:31:39.057+0530 W STORAGE [initandlisten] Recovering data from the last clean checkpoint.
2017-03-05T00:31:39.057+0530 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=3584M,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2017-03-05T00:31:39.620+0530 I CONTROL [initandlisten]
2017-03-05T00:31:39.620+0530 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-03-05T00:31:39.620+0530 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2017-03-05T00:31:39.620+0530 I CONTROL [initandlisten]
2017-03-05T00:31:39.620+0530 I CONTROL [initandlisten]
2017-03-05T00:31:39.620+0530 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2017-03-05T00:31:39.643+0530 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2017-03-05T00:31:39.643+0530 I NETWORK [thread1] waiting for connections on port 27017
2017-03-05T00:31:40.008+0530 I FTDC [ftdc] Unclean full-time diagnostic data capture shutdown detected, found interim file, some metrics may have been lost. OK
2017-03-05T00:32:03.832+0530 I NETWORK [thread1] connection accepted from 127.0.0.1:49806 #1 (1 connection now open)
2017-03-05T00:32:03.833+0530 I NETWORK [conn1] received client metadata from 127.0.0.1:49806 conn1: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "3.4.2" }, os: { type: "Darwin", name: "Mac OS X", architecture: "x86_64", version: "16.4.0" } }
2017-03-05T00:32:08.376+0530 I - [conn1] end connection 127.0.0.1:49806 (1 connection now open)
After that open another terminal and just type 'mongo'.
Following is output you can see :
$ mongo
MongoDB shell version v3.4.2
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.2
Your issue solved :)
I also have the same problem then I got fixed by these two lines of code. Hope, it helps
systemctl start mongod
systemctl enable mongod
Start monogdb service using
sudo service mongod start
then from the new window or terminal start mongo client using
mongo
After exhausting lots and lots of sulotions, I did-
sudo brew services start mongodb-community rather than
sudo service mongod start and it worked.
So, first try
sudo brew services start mongodb-community
and then to start the mongo shell, do-
mongo
FOR MACOS
Check the status of the services:
brew services
If you have something like:
Name Status
mongodb-community error
So you can just to stop and restart the service like this:
brew services stop mongodb-community
brew services start mongodb-community
This was happening with me today and I resolved it in following way.
Machine: I'm using Windows 10 machine and downloaded the latest MongoDB - Community edition.
So, the problem was, I did not have C:\data\db created.
Without creating C:\data\db, I opened CMD terminal and started the database using mongod command at terminal
C:\YourInstallationPath\bin>mongod
And when I fired mongo command then I was getting the problem.
Twist, I created the necessary folders but still was getting the problem. And this is because mongo server was already running. To fix it, I fired up mongod command again, and it automatically referenced to C:\data\db.
Other users have suggested to add C:\data\db but did not talk about executing mongod again, which exactly solved my problem.
I had same problem to connect mongodb after install using brew on macOS.
The problem was also mongod.lock but before i had mongodb 3.6 installed and database directory was /usr/local/var/mongodb and it have old files and mongod.lock
Simple i moved my old database files to different folder and removed everything from /usr/local/var/mongodb
Then restarted :
brew services restart mongodb
And it's working fine now.
I was getting this error on ubuntu but you can try with the following command:
sudo service mongod start
You can try with following command:
sudo service mongod start
in my case in windows and ubuntu, i needed to create /data/db folder in root. In ubuntu, i needed one additional option; to give permissions for directory.
windows
mkdir c:/data/db
ubuntu:
sudo mkdir -p /data/db
sudo chmod 700 /data/db
then run
sudo service mongod start
check
sudo service mongod status
and then run
mongo
Remove mongod.lock file. And run "mongod -repair". uninstall/reinstall mongod service fixed that problem for me.
Thanks.
Another solution that resolved this same error for me, though this one might only be if you are accessing mongo (locally) via a SSH connection via a virtual machine (at least that's my setup), and may be a linux specific environment variable issue:
export LC_ALL=C
Also, I have had more success running mongo as a daemon service then with sudo service start, my understanding is this uses command line arguments rather then the config file so it likely is an issue with my config file:
mongod --fork --logpath /var/log/mongodb.log --auth --port 27017 --dbpath /var/lib/mongodb/admin
Create the folder C:data/db if it doesn't already exist on your computer. Turns out MongoDB requires the existence of this folder structure 'data/db' to run. I hope this helps someone.
The cause by me was the space - run this in the console:
df -h
or more specifically:
du -hs /var/lib/mongodb/
to check he disk usage. If it's ~ 99% - just clean up some space and try again!
First, go to c:\mongodb\bin> to turn on mongoDB, if you see in console that mongo is listening in port 27017, it is OK
If not, close console and create folder c:\data\db and start mongod again
if all the solution above doesn't work out perhaps then this might be one to help. Somewhere down the line you may have made connection to your local mongodb database via vagrant boxes.
vagrant up and then ssh into your vagrant machine in which you've made connection with mongodb (vagrant ssh vagrant_box_name)
comment out the bind_ip line from /etc/mongod.conf using # (sudo nano /etc/mongod.conf )
restart your mongodb daemon service (sudo service mongod restart)
voila...
OK, this may be strange. My error happened because my log grew exponentially and clogged up server space hence mongo didn't get enough space to store anything.
so I cleared the log
> /var/log/mongod.log
When we take taskbar manager, go to Service tab. There MongoDB status shows the stopped. Right click for start. Its will connect MongoDB server version.
for checking type "db".
db
test
It will work fine.

Categories