|
Post by evilleweather on Jan 12, 2018 12:35:45 GMT -8
I am unable to get the GroveWeatherPi system to start.
I am getting this error:
Error 1049: Unknown database 'GroveWeatherPi' Traceback (most recent call last): File "GroveWeatherPi.py", line 1750, in <module> pclogging.log(pclogging.INFO, __name__, "GroveWeatherPi Startup Version 2.99") File "/home/pi/SDL_Pi_GroveWeatherPi/pclogging.py", line 70, in log cur.close() UnboundLocalError: local variable 'cur' referenced before assignment
It doesn't seem to detect the GroveWeatherPi.sql which is present. I downloaded the entire git repository since there is no way to tell what is needed to run the basic weather station without a solar panel.
I have installed the software listed on the readme file.
I'd like to get this figured out so I could run my weather station and install other components.
This is the full error I get after typing sudo python GroveWeatherPi.py
>>>>>>>>>>>>>>>>>>><<<<<<<<<<< TCA9545 I2C Mux Not Present >>>>>>>>>>>>>>>>>>><<<<<<<<<<< Error accessing 0x48: Check your I2C address Error accessing 0x48: Check your I2C address Type Error
GroveWeatherPi Solar Powered Weather Station Version 2.99 - SwitchDoc Labs
Program Started at:2018-01-12 12:09:56
---------------------- I2C Mux - TCA9545: Not Present BMP280: Present DS3231: Present HDC1080: Not Present HTU21DF: Not Present AM2315: Present ADS1015: Not Present ADS1115: Not Present AS3935: Not Present OLED: Not Present SunAirPlus: Not Present Sunlight Sensor: Not Present WXLink: Not Present
UseMySQL: Present Check WLAN: Present WeatherUnderground: Not Present ---------------------- Error 1049: Unknown database 'GroveWeatherPi' Traceback (most recent call last): File "GroveWeatherPi.py", line 1750, in <module> pclogging.log(pclogging.INFO, __name__, "GroveWeatherPi Startup Version 2.99") File "/home/pi/SDL_Pi_GroveWeatherPi/pclogging.py", line 70, in log cur.close() UnboundLocalError: local variable 'cur' referenced before assignment pi@weatherpi:~/SDL_Pi_GroveWeatherPi $ sudo python GroveWeatherPi.py >>>>>>>>>>>>>>>>>>><<<<<<<<<<< TCA9545 I2C Mux Not Present >>>>>>>>>>>>>>>>>>><<<<<<<<<<< Error accessing 0x48: Check your I2C address Error accessing 0x48: Check your I2C address Type Error
GroveWeatherPi Solar Powered Weather Station Version 2.99 - SwitchDoc Labs
Program Started at:2018-01-12 12:11:39
---------------------- I2C Mux - TCA9545: Not Present BMP280: Present DS3231: Present HDC1080: Not Present HTU21DF: Not Present AM2315: Present ADS1015: Not Present ADS1115: Not Present AS3935: Not Present OLED: Not Present SunAirPlus: Not Present Sunlight Sensor: Not Present WXLink: Not Present
UseMySQL: Present Check WLAN: Present WeatherUnderground: Not Present ---------------------- Error 1049: Unknown database 'GroveWeatherPi' Traceback (most recent call last): File "GroveWeatherPi.py", line 1750, in <module> pclogging.log(pclogging.INFO, __name__, "GroveWeatherPi Startup Version 2.99") File "/home/pi/SDL_Pi_GroveWeatherPi/pclogging.py", line 70, in log cur.close() UnboundLocalError: local variable 'cur' referenced before assignment
|
|
|
Post by doxidad on Jan 12, 2018 17:14:39 GMT -8
Grove Weathering.sql is just a script that creates the database and tables. Did you install mysql and then run the sql script to create the database?
|
|
|
Post by evilleweather on Jan 12, 2018 22:00:00 GMT -8
Grove Weathering.sql is just a script that creates the database and tables. Did you install mysql and then run the sql script to create the database? Yes I did. And it didn't seem to work. Which is why I am asking for help. I followed these MySQL install instructions: MySQL There are lots of tutorials on the net for installing MySQL. Here is the one we used ( http://raspberrywebserver.com/sql-databases/using-mysql-on-a-raspberry-pi.html ). Remember to use MySQL to set up the GroveWeatherPi Database as shown in the README.md Then I typed this command: mysql -u root -p GroveWeatherPi< GroveWeatherPi.sql I this error every time I entered the password. ERROR 1698 (28000): Access denied for user 'root'@'localhost' I'm not really sure what password is correct because I can't find install instructions beyond the Readme.md. Since it's a new install, I tried: sudo mysql -u root -p GroveWeatherPi< GroveWeatherPi.sql Again, it asks for a password. After entering, I got this reply: ERROR 1049 (42000): Unknown database 'GroveWeatherPi' I'd like to get this figured out so I could run my weather station and install other components. Does someone have a possible solution?
|
|
|
Post by doxidad on Jan 13, 2018 4:19:09 GMT -8
I bet you have the newer version of mysql - now called mariaDB. The mysql installation used to prompt you to enter a password that you want to use for root the newer one doesn't. Note root for the raspberryPi is NOT the same root for mysql. Mysql has its own root (lets call it the database administrator). I ran into the same problem a while back and I have been using mysql for way over 10 years. The solution is to follow the steps that are spelled out in the wiki (its ubuntu but that is really debian linux just like raspbian that is on the Pi). So look at this an see if it helps. It's a number of steps. Not sure why the maintainers of this product did this other than it is now owned/subsidized/whatever by Oracle who never makes things easy (or cheap!). help.ubuntu.com/community/MysqlPasswordReset
|
|
|
Post by evilleweather on Jan 13, 2018 12:33:09 GMT -8
Why would the directions tell you to install the wrong software?
|
|
|
Post by doxidad on Jan 13, 2018 16:57:58 GMT -8
The directions did not have you install the wrong software - sorry if I confused the issue.
It is still called mysql in the distributions. The later versions are now called MariaDB inside even though they are packages as mysql and the the database daemon is still called mysqld.
The big difference is when you installed it - it ass a newer version and you were never asked to supply a initial password for root. Which I am assuming is your problem.
Here is the image running on one of my RPis notice it is mysqld
534 ? Ssl 41:33 /usr/sbin/mysqld
If I get into the database with the mysql command notice that the sign on says MariaDB
pi@wpi ~ $ sudo mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 4449 Server version: 10.1.23-MariaDB-9+deb9u1 Raspbian 9.0
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
So, you installed the right software but the root password was not setup in the installation like the previous versions.
I'm sorry for the confusion. Just trying to help. You might try the info in the link I gave to set the root password - all of the commands will work.
|
|
|
Post by SDL on Jan 14, 2018 12:48:34 GMT -8
Well, I admit you guys did a better job on this one than I could have! Thanks!
Best, BP
|
|
matt
New Member
Posts: 13
|
Post by matt on Mar 10, 2018 12:29:16 GMT -8
I'm sorry to restart this thread, but I'm suffering from the same problem (no root mysql password). I'm following this tutorial to setup the mysql database for the first time, for use with my GroveWeatherPi board. raspberrywebserver.com/sql-databases/using-mysql-on-a-raspberry-pi.htmlpi@raspberrypi:~ $ mysql -u root -p Enter password: ERROR 1698 (28000): Access denied for user 'root'@'localhost'
So I followed this tutorial referenced earlier in this thread. help.ubuntu.com/community/MysqlPasswordResetpi@raspberrypi:~ $ sudo /etc/init.d/mysql stop [ ok ] Stopping mysql (via systemctl): mysql.service. pi@raspberrypi:~ $ sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &[3] 21377 pi@raspberrypi:~ $ 2018-03-10 14:17:23 1996136448 [Note] /usr/sbin/mysqld (mysqld 10.1.23-MariaDB-9+deb9u1) starting as process 21381 ...
pi@raspberrypi:~ $ mysql -u root ERROR 1698 (28000): Access denied for user 'root'@'localhost' pi@raspberrypi:~ $ sudo mysql -u root Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 6 Server version: 10.1.23-MariaDB-9+deb9u1 Raspbian 9.0
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> SET PASSWORD FOR root@'localhost' = PASSWORD('password'); Query OK, 0 rows affected, 1 warning (0.00 sec)
MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit Bye pi@raspberrypi:~ $ sudo /etc/init.d/mysql stop [ ok ] Stopping mysql (via systemctl): mysql.service. pi@raspberrypi:~ $ sudo /etc/init.d/mysql start [....] Starting mysql (via systemctl): mysql.service ^C
I have to use "ctrl^c" command to get the terminal back. mysql doesn't restart. If I restart the Raspberry Pi it's working but without any password access. I've even tried the last resort listed from the referenced link ( help.ubuntu.com/community/MysqlPasswordReset), purging and reinstalling I get the same results as are shown above. So I can't create the databases needed for GroveWeatherPi. Thanks for any help.
|
|
|
Post by SDL on Mar 10, 2018 13:58:12 GMT -8
Hi,
I'm looking at your output and wonder about this statement:
MariaDB [(none)]> SET PASSWORD FOR root@'localhost' = PASSWORD('password'); Query OK, 0 rows affected, 1 warning (0.00 sec)
I'm wondering if that statement worked. 0 rows affected?
It looks like you have mariah 10.1.23 and so you should use this statement:
For MySQL 5.7.6 and newer as well as MariaDB 10.1.20 and newer, use the following command.
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
----rant on---- BTW, this is one of my big beefs about a lot of these guys that maintain these open source programs (BTW, I love that these exist and I love them all - really) is that they change features like the statement up above and break all backward compatibility.
-----rant off----
Best regards,
BP
|
|
matt
New Member
Posts: 13
|
Post by matt on Mar 10, 2018 20:06:59 GMT -8
I admit I'm beginning to just flail about now. I tried BP's suggestion (it's buried in the sample below), it's complaining about syntax. I also tried other options listed from the Ubuntu Mysqlpassword reset page I linked to earlier.
pi@raspberrypi:~ $ sudo /etc/init.d/mysql stop [ ok ] Stopping mysql (via systemctl): mysql.service. pi@raspberrypi:~ $ pi@raspberrypi:~ $ sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking & [1] 1373 pi@raspberrypi:~ $ 2018-03-10 21:58:09 1996140544 [Note] /usr/sbin/mysqld (mysqld 10.1.23-MariaDB-9+deb9u1) starting as process 1378 ...
pi@raspberrypi:~ $ mysql -u root Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 10.1.23-MariaDB-9+deb9u1 Raspbian 9.0
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> USE mysql Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
Database changed MariaDB [mysql]> UPDATE user SET Password = PASSWORD('newpwd') -> WHERE Host = 'localhost' AND User = 'root'; Query OK, 0 rows affected (0.01 sec) Rows matched: 1 Changed: 0 Warnings: 0
MariaDB [mysql]> UPDATE user SET Password = PASSWORD('newpwd') -> WHERE Host = 'localhost' AND User = 'root'; Query OK, 0 rows affected (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 0
MariaDB [mysql]> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password'; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USER 'root'@'localhost' IDENTIFIED BY 'new_password'' at line 1 MariaDB [mysql]> UPDATE user SET Password = PASSWORD('newpwd') WHERE Host = 'localhost' AND User = 'root'; Query OK, 0 rows affected (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 0
MariaDB [mysql]> exit Bye pi@raspberrypi:~ $ mysql -u root Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 10.1.23-MariaDB-9+deb9u1 Raspbian 9.0
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> UPDATE user SET Password = PASSWORD('newpwd') WHERE Host = 'localhost' AND User = 'root'; ERROR 1046 (3D000): No database selected MariaDB [(none)]> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password'; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USER 'root'@'localhost' IDENTIFIED BY 'new_password'' at line 1 MariaDB [(none)]> USE mysql Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
Database changed MariaDB [mysql]> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password'; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USER 'root'@'localhost' IDENTIFIED BY 'new_password'' at line 1 MariaDB [mysql]> UPDATE user SET Password = PASSWORD('newpwd') WHERE Host = 'localhost' AND User = 'root'; Query OK, 0 rows affected (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 0
|
|
matt
New Member
Posts: 13
|
Post by matt on Mar 10, 2018 20:46:03 GMT -8
*EDITED* I think I've done it using this tutorial: www.digitalocean.com/community/tutorials/how-to-reset-your-mysql-or-mariadb-root-passwordI believe that this command specifically was what worked in the end (at the time) UPDATE mysql.user SET authentication_string = PASSWORD('new_password') WHERE User = 'root' AND Host = 'localhost'; I couldn't figure out how to cleanly stop the 'mysqld_safe' process, so I just rebooted to be sure. Thanks for the help, and I hope this can help someone else.Clearly I don't understand what I'm doing.
|
|
|
Post by SDL on Mar 11, 2018 17:17:42 GMT -8
That's great Matt.
They have certainly made this more difficult than it used to be.
BP
|
|
matt
New Member
Posts: 13
|
Post by matt on Mar 11, 2018 17:30:58 GMT -8
I guess I did a bad job of editing my post. After checking today I have a root password that works for the MySQLadmin application but that same password doesn’t work after restarting in regular MySQL. Sorry any additional suggestions are welcome.
|
|
|
Post by SDL on Mar 12, 2018 15:02:54 GMT -8
Matt,
That is a new one to me. How do you know it works for MYSQLAdmin? Then you reboot or just restart MySQL. Any other folks have a good suggestion on this?
BP
|
|
matt
New Member
Posts: 13
|
Post by matt on Mar 30, 2018 13:12:21 GMT -8
Here is the exact transcript of my attempts, many process only seem work if I use 'sudo' in front of the suggested commands. Again I'm attempting to use the ubuntu mysql reset process outlined here: help.ubuntu.com/community/MysqlPasswordResetpi@raspberrypi:~ $ sudo /etc/init.d/mysql stop [ ok ] Stopping mysql (via systemctl): mysql.service. pi@raspberrypi:~ $ sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking & [1] 20351 pi@raspberrypi:~ $ 2018-03-30 15:57:18 1995988992 [Note] /usr/sbin/mysqld (mysqld 10.1.23-MariaDB-9+deb9u1) starting as process 20355 ...
pi@raspberrypi:~ $ sudo mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 10.1.23-MariaDB-9+deb9u1 Raspbian 9.0
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.04 sec)
MariaDB [(none)]> UPDATE mysql.user SET authentication_string = PASSWORD('new_password') WHERE User = 'root' AND Host = 'localhost'; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0
MariaDB [(none)]> MariaDB [(none)]> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.01 sec) MariaDB [(none)]> exit Bye
pi@raspberrypi:~ $ sudo /etc/init.d/mysql stop [ ok ] Stopping mysql (via systemctl): mysql.service. pi@raspberrypi:~ $ sudo /etc/init.d/mysql start [....] Starting mysql (via systemctl): mysql.service Job for mariadb.service failed because a timeout was exceeded. See "systemctl status mariadb.service" and "journalctl -xe" for details. failed!
pi@raspberrypi:~ $ sudo htop [1]+ Done sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking pi@raspberrypi:~ $ sudo /etc/init.d/mysql start [ ok ] Starting mysql (via systemctl): mysql.service. pi@raspberrypi:~ $ mysql -u root -p GroveWeatherPi< /home/pi/SDL_Pi_GroveWeatherPi/MySQLFiles/GroveWeatherPi.sql Enter password: ERROR 1698 (28000): Access denied for user 'root'@'localhost' pi@raspberrypi:~ $ mysql -u root -p GroveWeatherPi< /home/pi/SDL_Pi_GroveWeatherPi/MySQLFiles/GroveWeatherPi.sql Enter password: ERROR 1698 (28000): Access denied for user 'root'@'localhost' pi@raspberrypi:~ $ sudo mysql -u root -p GroveWeatherPi< /home/pi/SDL_Pi_GroveWeatherPi/MySQLFiles/GroveWeatherPi.sql Enter password: ERROR 1049 (42000): Unknown database 'GroveWeatherPi'
So I've changed mysql root password to 'new_password' but it only seems to accept it if I use 'sudo' in front of my mysql commnads, which I assume will be a problem for the various scripts and python routines that aren't running as 'sudo' Also, I can't get mysqld to end without logging in to htop and finding the process and killing it there. Nothing I've tried seems to kill it nicely. What am I missing? Thanks in advance.
|
|