Post by doxidad on Mar 31, 2018 5:43:27 GMT -8
I can see 2 things. You are starting with sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &
You are trying to stop it with a script sudo /etc/init.d/mysql stop which may not work since you started mysql with a command to run in the background "&". You have executed with username "pi" as opposed to having the system start it. This _could_ be the cause of you not being able to stop it. Can you stop it when you start it this way sudo /etc/init.d/mysql start?
2ndly - You are running the script against the database GroiveWeatherPi. Did you create the database first. The script just creates the tables. The database has be created before the script will run. When you log into mysql show the databases. Example:
pi@wpi ~ $ sudo mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 36
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)]> show databases;
+--------------------+
| Database |
+--------------------+
| GroveWeatherPi |
| information_schema |
| mysql |
| performance_schema |
| phpmyadmin |
+--------------------+
5 rows in set (0.00 sec)
See if the database GroveWeatherPi exists. If not create it like this:
MariaDB [(none)]> create database testdatabase;
Query OK, 1 row affected (0.00 sec)
I used the database testdatabase since I already have a GroveWeatherPi database.
showing the databases again will prove that it was created.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| GroveWeatherPi |
| information_schema |
| mysql |
| performance_schema |
| phpmyadmin |
| testdatabase |
+--------------------+
I hope this helps a bit.
You are trying to stop it with a script sudo /etc/init.d/mysql stop which may not work since you started mysql with a command to run in the background "&". You have executed with username "pi" as opposed to having the system start it. This _could_ be the cause of you not being able to stop it. Can you stop it when you start it this way sudo /etc/init.d/mysql start?
2ndly - You are running the script against the database GroiveWeatherPi. Did you create the database first. The script just creates the tables. The database has be created before the script will run. When you log into mysql show the databases. Example:
pi@wpi ~ $ sudo mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 36
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)]> show databases;
+--------------------+
| Database |
+--------------------+
| GroveWeatherPi |
| information_schema |
| mysql |
| performance_schema |
| phpmyadmin |
+--------------------+
5 rows in set (0.00 sec)
See if the database GroveWeatherPi exists. If not create it like this:
MariaDB [(none)]> create database testdatabase;
Query OK, 1 row affected (0.00 sec)
I used the database testdatabase since I already have a GroveWeatherPi database.
showing the databases again will prove that it was created.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| GroveWeatherPi |
| information_schema |
| mysql |
| performance_schema |
| phpmyadmin |
| testdatabase |
+--------------------+
I hope this helps a bit.