In the database, the IP addresses and Visitor IDs are stored in Binary form for storage efficiency. To display these values correctly you can use the following SQL query:

SELECT INET6_NTOA(`location_ip`) as ip, conv(hex(idvisitor), 16, 16) as visitorId FROM matomo_log_visit;

If you use MySQL 5.6.2 or earlier, you will have to use this SQL query instead (which only supports IPv4):

SELECT inet_ntoa(conv(hex(location_ip), 16, 10)) as ip, conv(hex(idvisitor), 16, 16) as visitorId FROM matomo_log_visit;

To select a specific visit if you know the idvisitor you can run this SQL query:

SELECT * FROM log_visit WHERE lower(conv(hex(idvisitor), 16, 16)) = 'a43f52349c8890af';

You may also be interested in: How do I select all users within a range of IP addresses?

Previous FAQ: How to convert the database to utf8mb4 charset?