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 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?