Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #57374
    glosnick
    Participant

    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.

    Nick

    #57375
    glosnick
    Participant

    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.

    Regards

    Nick

    #57378
    Diego PérezDiego Pérez
    Moderator

    Hi!
    I don’t get what you mean by page by page, databases don’t have pages, so can you explain?

    Thanks!
    Diego

    #57383
    glosnick
    Participant

    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:

    show databases;

    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.

    Nick

    #57384
    glosnick
    Participant

    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

    Nick

    #57385
    glosnick
    Participant

    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!

    Nick

    #57391
    glosnick
    Participant

    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.

    Regards

    Nick

    #57400
    Diego PérezDiego Pérez
    Moderator

    Hi!
    Yeah, table_name is a column in TABLES table. Here is mysql’s information_schema documentation, take a look at it:
    https://dev.mysql.com/doc/refman/8.0/en/information-schema.html

    Greetings!
    Diego

    #57442
    glosnick
    Participant

    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.

    Nick

    #57444
    glosnick
    Participant

    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

    show databases;
    use information_schema;
    pager less;
    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?

    Regards

    Nick

    #57470
    Diego PérezDiego Pérez
    Moderator

    Hi!
    That happens when the table contains many columns, in such case the only solution is to select just a few columns at a time.

    Greetings!
    Diego

    #57557
    glosnick
    Participant

    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?

    Regards

    Nick

    #57585
    Diego PérezDiego Pérez
    Moderator

    Hi!

    Yes, just use a select query, for example:

    select username,password from users;

    Greetings!
    Diego

    #57632
    glosnick
    Participant

    So simple when you know how.

    Thanks and regards

    Nick

    #57637
    Diego PérezDiego Pérez
    Moderator

    You’re welcome!

    Greetings!
    Diego

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.