Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mysql> SELECT `volume` , `temp` , `humidity` , `co2` , `pressure` FROM `measurements` ORDER BY `ID` DESC LIMIT 1;
- +--------+------+----------+-------+----------+
- | volume | temp | humidity | co2 | pressure |
- +--------+------+----------+-------+----------+
- | 59.76 | 1.88 | 13.7 | 44.62 | 0 |
- +--------+------+----------+-------+----------+
- $sql = 'SELECT volume FROM measurements ORDER BY ID DESC LIMIT 1';
- $sql = 'SELECT volume, temp , humidity FROM measurements ORDER BY ID DESC LIMIT 1';
- $sql = 'SELECT * FROM measurements ORDER BY ID DESC LIMIT 1';
- <?php
- ini_set('display_errors', 'On');
- error_reporting(E_ALL | E_STRICT);
- $servername = "localhost";
- $username = "XYZ";
- $password = "12345";
- $myDB = "database";
- try {
- $conn = new PDO("mysql:host=$servername;dbname=$myDB", $username, $password);
- // set the PDO error mode to exception
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- //echo "Connected successfully";
- }
- catch(PDOException $e)
- {
- echo "Connection failed: " . $e->getMessage();
- }
- $sql = 'SELECT volume, temp , humidity FROM measurements ORDER BY ID DESC LIMIT 1';
- foreach ($conn->query($sql) as $row) {
- $first_volume = number_format ( $row['volume'],1);
- $first_temp = number_format ( $row['temp'],1);
- $first_humidity = number_format ( $row['humidity'],1);
- $first_co2 = number_format ( $row['co2'],1);
- $first_pressure = number_format ( $row['pressure'],0);
- }
- $conn = null;
- ?>
- port = 3306
- socket = /tmp/mysql.sock
- user=root
- [mysqld]
- innodb_force_recovery = 0
- datadir = /var/lib/mysql
- max_allowed_packet=256M
- # Remove leading # and set to the amount of RAM for the most important data
- # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
- innodb_buffer_pool_size = 8M
- # Remove leading # to turn on a very important data integrity option:
- #logging
- # changes to the binary log between backups.
- # log_bin
- # Remove leading # to turn on error logging.
- log_error = hostname_error.log
- #log_error=/var/log/mysql
- # we have a read-only filesystem with one persistent writeable area only
- # so point to this single writeable location
- datadir = /var/lib/mysql/data
- # These are commonly set, remove the # and set as required.
- # lc-messages-dir = .....
- # plugin-dir = .....
- # basedir = .....
- port = 3306
- # server_id = .....
- pid_file = /var/run/mysqld/mysqld.pid
- user=root
- # Remove leading # to set options mainly useful for reporting servers.
- # The server defaults are faster for transactions and fast SELECTs.
- # Adjust sizes as needed, experiment to find the optimal values.
- join_buffer_size = 8M
- sort_buffer_size = 2M
- read_rnd_buffer_size = 2M
- sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
- if ( preg_match( "%^(www.)?livedomain.com$%", $_SERVER["HTTP_HOST"]) ) {
- define('APPLICATION_LIVE', true);
- } elseif ( preg_match( "%^(www.)?devdomain.net$%", $_SERVER["HTTP_HOST"]) ) {
- define('APPLICATION_LIVE', false);
- } else {
- die("INVALID HOST REQUEST (".$_SERVER["HTTP_HOST"].")");
- // Log or take other appropriate action.
- }
- 2015-03-31T22:05:20.525812Z 2 [Note] Aborted connection 2 to db: 'database' user: 'root' host: 'localhost' (Got an error reading communication packets)
- 2015-03-31T22:05:21.897761Z 3 [Note] Aborted connection 3 to db: 'database' user: 'root' host: 'localhost' (Got an error reading communication packets)
- 2015-03-31T22:05:23.136331Z 4 [Note] Aborted connection 4 to db: 'database' user: 'root' host: 'localhost' (Got an error reading communication packets)
- wait_timeout=2147483
- max_allowed_packet=1073741824
- interactive_timeout=90800
- connect_timeout=31536000
- max_execution_time = 30 ; Maximum execution time of each script, in seconds
- max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
- ;max_input_nesting_level = 64 ; Maximum input variable nesting level
- memory_limit = 128M ; Maximum amount of memory a script may consume (128MB)
- root@Bone:~ netstat -a | grep mysql
- tcp 0 0 :::mysql :::* LISTEN
- unix 2 [ ACC ] STREAM LISTENING 7347 /tmp/mysql.sock
- 00:19:38.400102 ARP, Request who-has 192.168.1.100 (d0:5f:b8:81:17:de (oui Unknown)) tell 192.168.1.200, length 46
- 00:19:38.400170 ARP, Reply 192.168.1.100 is-at d0:5f:b8:81:17:de (oui Unknown), length 28
- 00:19:40.399156 ARP, Request who-has 192.168.1.1 tell 192.168.1.200, length 46
- root@Bone:/var ls -l ./pt-mysql-summary
- -rwxr-xr-x 1 root root 104093 Apr 1 00:10 ./pt-mysql-summary
- root@Bone:/var ./pt-mysql-summary
- -sh: ./pt-mysql-summary: not found
- eth0 Link encap:Ethernet HWaddr D0:5F:B8:81:17:DE
- inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
- inet6 addr: fe80::d25f:b8ff:fe81:17de/64 Scope:Link
- UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
- RX packets:1105 errors:0 dropped:0 overruns:0 frame:0
- TX packets:412 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:1000
- RX bytes:90361 (88.2 KiB) TX bytes:68063 (66.4 KiB)
- Interrupt:174
- lo Link encap:Local Loopback
- inet addr:127.0.0.1 Mask:255.0.0.0
- inet6 addr: ::1/128 Scope:Host
- UP LOOPBACK RUNNING MTU:65536 Metric:1
- RX packets:11 errors:0 dropped:0 overruns:0 frame:0
- TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:1
- RX bytes:937 (937.0 B) TX bytes:937 (937.0 B)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement