- August 5, 2021 at 1:31 pm #57374
I was trying to understand what the following statement meant:
(when I tried writing the exact statement I got blocked, if this message goes through it means that this statement was the problem. The statement being the one Zaid used in lecture 12.3 to get a list of the tables in the owasp10 database).
So I tried navigating using mysql in on the metasploit VM to explore the databases and tables. What I found was that some of the tables are so big that I couldn’t figure out how to look at them. Is there a way in mysql to look at a table page by page. I tried searching google and there does appear to be a way but I couldn’t figure out how to implement it.
If you could let me know I’d greatly appreciate it.
Thanks and regards.
NickAugust 5, 2021 at 1:33 pm #57375
It looks like my original message was blocked when I typed out the full statement Zaid used. Anyway, all I really wanted to know was a method that I could look at a table in mysql page by page.
NickAugust 5, 2021 at 5:22 pm #57378
I don’t get what you mean by page by page, databases don’t have pages, so can you explain?
DiegoAugust 6, 2021 at 10:53 am #57383
Ok I started mysql on the metasploitable VM and entered the following command:
select table_name from information_schema.tables;
Having first used the command:
Just to practice navigating and exploring the available databases on metasploit to see if I could understand it further. However, the results from the select table_name…. command were 430 rows and I could only see the last few. Hence, my question, in Linux I think you are able to control how information scrolls through the terminal with the more or less command (I think, please correct me if I’m wrong). So is it possible to do this in MySQL. Have the terminal display a page of rows and then press a key to display more so that you can peruse the information at leisure. I searched google and it seemed to indicate that you should use pager but when I used the \P I got an error saying pager was not my default pager and I couldn’t figure out how to set it up so it was. I hope this makes more sense about what I’m trying to achieve and you can help me.
Regards and thanks again.
NickAugust 6, 2021 at 10:57 am #57384
I think what was confusing me was the table_schema = ‘owasp10’. I thought that this was a table in information_schemata.tables and wanted to have a look to see if it was there and the information it contained. I assume it contains information about which database particular tables come from. Well maybe. I could be wrong please could you clarify.
Thanks and regards
NickAugust 6, 2021 at 11:01 am #57385
Or is table_schema a different command that means something other than what I think it means. Sorry I’m probably rambling now!
Have a nice day!
NickAugust 6, 2021 at 3:57 pm #57391
So is table_name a column name from information_schema.tables (even though I haven’t been able to find it yet) and how does table_schema fit in with that?
Sorry to go on but I’m just trying to get my head around what is happening.
NickAugust 6, 2021 at 5:51 pm #57400
Yeah, table_name is a column in TABLES table. Here is mysql’s information_schema documentation, take a look at it:
DiegoAugust 9, 2021 at 10:42 am #57442
Thanks for your reply, that certainly sheds a little light on the subject. The only problem or at least one of the many that I have remaining is how can I scroll page by page through a list a results when I perform a query that yields a large number of rows?
Thanks again and regards.
NickAugust 9, 2021 at 11:40 am #57444
I’m a little chuffed with myself and just thought I’d share with somebody who might understand. I cracked the problem of how to get the results to display page by page with the ‘pager less’ command before running my select command so then the results are displayed page by page. The only issue now and perhaps you could shed some light on this is the when I run the following commands in MySQL on the metasploitable VM
select * from tables;
The results whilst shown page by page are very chaotic and not all lined up neatly as in the results of show databases for example. Would you happen to know why?
NickAugust 9, 2021 at 5:25 pm #57470
That happens when the table contains many columns, in such case the only solution is to select just a few columns at a time.
DiegoAugust 11, 2021 at 6:43 pm #57557
Ok, thanks for the response. How would I select a few of the columns at a time? Is there a particularly clever way of doing it in MySQL?
NickAugust 12, 2021 at 7:16 pm #57585
Yes, just use a select query, for example:
select username,password from users;
DiegoAugust 14, 2021 at 4:10 pm #57632
So simple when you know how.
Thanks and regards
NickAugust 14, 2021 at 6:27 pm #57637
- You must be logged in to reply to this topic.