I have a mysql database set up on a mac mini server on a local network. When I query the database from the server as the root user, everything behaves well. However, I am having serious problems when I log into mysql from another machine on the local network I perform those same queries.
For example, the table items has 1,831,218 rows and two columns, item and total (not indexed). When I perform the following query is is very quick as expected:
mysql> select * from items limit 10;
+------+-----------+
| item | total |
+------+-----------+
| a | 577846916 |
| b | 489378579 |
| c | 485798873 |
| d | 476865689 |
| e | 425954264 |
| f | 399431640 |
| g | 375218023 |
| h | 325892006 |
| i | 169948795 |
| j | 116927132 |
+------+-----------+
10 rows in set (0.00 sec)
Now by logging in remotely from another machine on the network:>mysql --host=192.168.2.2 -u newuser -p, where newuser has select privileges on the database, I perform the same query and get wildly different execution times.
mysql> select * from items limit 10;
+------+-----------+
| item | total |
+------+-----------+
| a | 577846916 |
| b | 489378579 |
| c | 485798873 |
| d | 476865689 |
| e | 425954264 |
| f | 399431640 |
| g | 375218023 |
| h | 325892006 |
| i | 169948795 |
| j | 116927132 |
+------+-----------+
10 rows in set (7 min 3.10 sec)
This is an exceptionally bad example that doesn't happen all the time, but in general queries are much slower (usually 10-100 times slower (or more) than on the server itself). For this much of a slow down it doesn't seem likely that the bottleneck has to do with latency in the network, but rather some configuration issue that is causing mysql to not communicate well with between the server and the various nodes.
Aside from verifying that both machines are running he same version of mysql: mysql Ver 14.14 Distrib 5.6.19, for osx10.7 (x86_64) using EditLine wrapper, I am not sure what other settings to verify and what else to do to try to fix this problem.
Please let me know if anyone has any ideas, thank you.
Related
I have deployed a freeradius server version 3.0 with MySQL in Ubuntu (20.04).
There are the respective versions of the radius and MySQL:
root#server:/etc/freeradius/3.0# mysql -V
mysql Ver 8.0.23-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))
root#server:/etc/freeradius/3.0# freeradius -v
radiusd: FreeRADIUS Version 3.0.20, for host x86_64-pc-linux-gnu, built on Jan 25 2020 at 06:11:13
FreeRADIUS Version 3.0.20
Copyright (C) 1999-2019 The FreeRADIUS server project and contributors
My situation is: from a mobile phone I need to connect to an access point and authenticate to that WLAN network (802.11i-WPA-802.1x) using a username and password specified in the radius database.
I would like to limit the number of concurrent logins per user (demouser in this case) to 1 because i only have one unique user. I have spent a lot of time searching the forums and documentation, but can't find anything to figure it.
This is the output of freeradius in debug mode.
I have several doubts about what would be the best way to create the user in the database.
At the moment it is configured in a basic way, that is to say I have specified in the radcheck table the user and in the nas table my client (the access point):
mysql> SELECT * FROM nas;
+----+-------------+-----------+-------+-------+----------+--------+-----------+---------------+
| id | nasname | shortname | type | ports | secret | server | community | description |
+----+-------------+-----------+-------+-------+----------+--------+-----------+---------------+
| 1 | 172.20.1.20 | AP_1 | other | NULL | 12345678 | NULL | NULL | Client Radius |
+----+-------------+-----------+-------+-------+----------+--------+-----------+---------------+
1 row in set (0.00 sec)
mysql> SELECT * FROM radcheck; SELECT * FROM radgroupcheck; SELECT * FROM radgroupreply; SELECT * FROM radusergroup;
+----+----------+--------------------+----+----------+
| id | username | attribute | op | value |
+----+----------+--------------------+----+----------+
| 1 | demouser | Cleartext-Password | := | demopass |
+----+----------+--------------------+----+----------+
1 row in set (0.00 sec)
+----+------------+------------------+----+-------+
| id | groupname | attribute | op | value |
+----+------------+------------------+----+-------+
| 1 | demo_group | Simultaneous-Use | := | 1 |
+----+------------+------------------+----+-------+
1 row in set (0.00 sec)
+----+------------+--------------------+----+---------------------+
| id | groupname | attribute | op | value |
+----+------------+--------------------+----+---------------------+
| 1 | demo_group | Service-Type | := | Framed-User |
| 2 | demo_group | Framed-Protocol | := | PPP |
| 3 | demo_group | Framed-Compression | := | Van-Jacobsen-TCP-IP |
+----+------------+--------------------+----+---------------------+
3 rows in set (0.00 sec)
+----+----------+------------+----------+
| id | username | groupname | priority |
+----+----------+------------+----------+
| 1 | demouser | demo_group | 0 |
+----+----------+------------+----------+
1 row in set (0.00 sec)
And if I see the logs file the authentications makes successfull:
This is the output of /var/log/freeradius/sqllog.sql
INSERT INTO radpostauth (username, pass, reply, authdate) VALUES ( 'demouser', '', 'Access-Accept', '2021-04-27 09:04:19');
This is the other output of /var/radacct/172.20.1.20/auth-detail....
Tue Apr 27 09:37:46 2021
Packet-Type = Access-Request
User-Name = "demouser"
Service-Type = Framed-User
NAS-IP-Address = 172.20.1.20
NAS-Port = 1
NAS-Port-Id = "1"
State = 0x7eea823f76e09b79e9fd1595f5ebf47a
Called-Station-Id = "EC-E5-55-FF-FB-34:HIRSCHMANN_C"
NAS-Port-Type = Wireless-802.11
WLAN-RF-Band = 2
WLAN-Pairwise-Cipher = 1027076
WLAN-Group-Cipher = 1027076
WLAN-AKM-Suite = 1027073
Calling-Station-Id = "78-B8-D6-32-9A-32"
Connect-Info = "CONNECT 72 Mbps 802.11g/n"
NAS-Identifier = "AP_1"
Framed-MTU = 1500
EAP-Message = 0x020a002e190017030300230000000000000004425534a3fe3939c900e3f3f672628ae179e4a05c48c1964a31dba1
Message-Authenticator = 0xd87613c17b7b62950f6613cbca20e109
Event-Timestamp = "Apr 27 2021 09:37:46 CEST"
Timestamp = 1619509066
And if I perform a select from the radpostauth table I also see that the user has been successfully authenticated.
mysql> select * from radpostauth;
+----+----------+------+---------------+---------------------+
| id | username | pass | reply | authdate |
+----+----------+------+---------------+---------------------+
| 55 | demouser | | Access-Accept | 2021-04-27 09:04:19 |
| 56 | demouser | | Access-Accept | 2021-04-27 09:04:19 |
+----+----------+------+---------------+---------------------+
The problem is that in the radacct table no data is stored, when I perform a select it appears empty, I have created another table which is radaacct2 with the same structure and specified in the mysql configuration file but no data is inserted either.
From what I understand (correct me if I'm wrong) Radius stores accounting data in radacct table. I read this document
If no data is stored, the following query will not be executed correctly. /etc/freeradius/3.0/main/mysql/queries.conf :
#######################################################################
# Simultaneous Use Checking Queries
#######################################################################
# simul_count_query - query for the number of current connections
# - If this is not defined, no simultaneous use checking
# - will be performed by this module instance
simul_count_query = "\
SELECT COUNT(*) \
FROM ${acct_table1} \
WHERE username = '%{SQL-User-Name}' \
AND acctstoptime IS NULL"
In short, I need to control the simultaneous login of a specific user and the cause of not working correctly I think it is due to not inserting data into the mysql table. I am probably wrong because I am new to this, I ask please that in the case that it is so, someone provide me with information on how to fix this problem or specify me really what is the error in question.
I have been working on this for weeks and it is the last thing I need to configure but I can't figure it out.
If any more configuration files are needed please let me know and I will attach them.
Help please
PD: as extra information I have to add that I have followed the configuration steps on this page and it still does not work.
Thanks
I am having a project where internet trafic is very expensive (metered connections).
Therefore I try to observe how much traffic is beeing used with different methods.
example statement:
SELECT Activation from Database.Table
WHERE ObjectID = 2382;
-------------------------
| Object ID | Activation|
|-----------|-----------|
| 2380 | 0 |
| 2381 | 0 |
| 2382 | 1 |
| 2383 | 0 |
| 2384 | 1 |
| 2385 | 0 |
-------------------------
=> returns 1 for example
Is there a method in SQL workbench, to precisely find out, how much traffic was beeing used for this query, or do I have to measure it using Wireshark?
Would http or other protocols use less traffic?
Best regards,
Julian
I'm new to MySQL and I'm using jdbc to connect with MySQL server. My current subjects table in the database with its entries are.
+--------+-----------+--------+---------+-------+----------+
| sub_no | name | lec_no | credits | price | semester |
+--------+-----------+--------+---------+-------+----------+
| cs001 | network 1 | lec001 | 3 | 3000 | 7 |
+--------+-----------+--------+---------+-------+----------+
but when I run SELECT credits,price,semester from subjects WHERE sub_no ="cs001" why does MySQL return an empty set instead of 3, 3000, 7
I think it's because mysql is searching for "cs001" and not cs001. Try removing the quotes and see what happens.
Is it possible to find the process ID or the command that is executed for a rollback ?
More specifically :
The Information_Schema of MySQL has a specific table named processlist. This contains the details about every ongoing process in MySQL. An example of the table looks like this:
mysql> select * from processlist;
+----+------+-----------+--------------------+---------+------+------------+---------------------------+
| ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO |
+----+------+-----------+--------------------+---------+------+------------+---------------------------+
| 5 | root | localhost | information_schema | Query | 5 | User sleep | select sleep(20) |
| 4 | root | localhost | information_schema | Query | 0 | executing | select * from processlist |
+----+------+-----------+--------------------+---------+------+------------+---------------------------+
Is it possible for me to intercept a Rollback and grab its ID or INFO from this table ? The issue I have been facing is that any Rollback I execute gets completed before I am able to intercept its ID from the Table.
I created a replication between two computers (a laptop I use to add new datas in my db and a server that save everything I do on the laptop) and it works fine.
But today, my laptop was online so I was not able to update my server.
Result : I updated some lines and I created a lot of lines and when my laptop was back online, the replication did not works on the datas I've been working on offline.
Could anybody give me an advice to update datas (on the server) that have been modified on the laptop while I was not connected ? I don't get why it doesn't works !
Thx !
update : here is my show slave status :
mysql> show slave status;
+----------------------------------+-------------+-------------+-------------+--
-------------+------------------+---------------------+-------------------------
---+---------------+-----------------------+------------------+-----------------
--+-----------------+---------------------+--------------------+----------------
--------+-------------------------+-----------------------------+------------+--
----------+--------------+---------------------+-----------------+--------------
---+----------------+---------------+--------------------+--------------------+-
-------------------+-----------------+-------------------+----------------+-----
------------------+-------------------------------+---------------+-------------
--+----------------+----------------+-----------------------------+-------------
-----+
| Slave_IO_State | Master_Host | Master_User | Master_Port | C
onnect_Retry | Master_Log_File | Read_Master_Log_Pos | Relay_Log_File
| Relay_Log_Pos | Relay_Master_Log_File | Slave_IO_Running | Slave_SQL_Runnin
g | Replicate_Do_DB | Replicate_Ignore_DB | Replicate_Do_Table | Replicate_Ignor
e_Table | Replicate_Wild_Do_Table | Replicate_Wild_Ignore_Table | Last_Errno | L
ast_Error | Skip_Counter | Exec_Master_Log_Pos | Relay_Log_Space | Until_Conditi
on | Until_Log_File | Until_Log_Pos | Master_SSL_Allowed | Master_SSL_CA_File |
Master_SSL_CA_Path | Master_SSL_Cert | Master_SSL_Cipher | Master_SSL_Key | Seco
nds_Behind_Master | Master_SSL_Verify_Server_Cert | Last_IO_Errno | Last_IO_Erro
r | Last_SQL_Errno | Last_SQL_Error | Replicate_Ignore_Server_Ids | Master_Serve
r_Id |
+----------------------------------+-------------+-------------+-------------+--
-------------+------------------+---------------------+-------------------------
---+---------------+-----------------------+------------------+-----------------
--+-----------------+---------------------+--------------------+----------------
--------+-------------------------+-----------------------------+------------+--
----------+--------------+---------------------+-----------------+--------------
---+----------------+---------------+--------------------+--------------------+-
-------------------+-----------------+-------------------+----------------+-----
------------------+-------------------------------+---------------+-------------
--+----------------+----------------+-----------------------------+-------------
-----+
| Waiting for master to send event | ***.***.***.*** | masterRepli | 3306 |
60 | mysql-bin.000027 | 454717 | aofr19072-relay-bin.0000
02 | 1227 | mysql-bin.000027 | Yes | Yes
| | | |
| | | 0 |
| 0 | 454717 | 1387 | None
| | 0 | No | |
| | | |
0 | No | 0 |
| 0 | | |
2 |
+----------------------------------+-------------+-------------+-------------+--
-------------+------------------+---------------------+-------------------------
---+---------------+-----------------------+------------------+-----------------
--+-----------------+---------------------+--------------------+----------------
--------+-------------------------+-----------------------------+------------+--
----------+--------------+---------------------+-----------------+--------------
---+----------------+---------------+--------------------+--------------------+-
-------------------+-----------------+-------------------+----------------+-----
------------------+-------------------------------+---------------+-------------
--+----------------+----------------+-----------------------------+-------------
-----+
1 row in set (0.00 sec)
BRUTE FORCE SYNC
I wrote out a detailed description on how to resync a Slave to its Master in a Circular Replication setup
PRECISION STRIKE SYNC
If you simply want to find the differences and update only differences, you must use mk-table-checksum and mk-table-sync.
Give it a Try !!!
Is it possible that the slave server just doesn't have the slave process running?
See if the slave process is running by typing SHOW SLAVE STATUS; at the MySQL command prompt on the slave.
Then try starting it with START SLAVE;
If it still isn't working, post the output of the SHOW SLAVE STATUS; command, and we'll try to help you further :)