selecting data from mysql using qt?

Page  
3

October 12, 2010

doforumda doforumda
Lab Rat
161 posts

here it is

  1. root@zafar-laptop:/# dpkg --list | grep mysql
  2. ii  libmysqlclient-dev                   5.1.41-3ubuntu12.6                              MySQL database development files
  3. ii  libmysqlclient16                     5.1.41-3ubuntu12.6                              MySQL database client library
  4. ii  mysql-common                         5.1.41-3ubuntu12.6                              MySQL database common files (e.g. /etc/mysql

October 12, 2010

lyuts lyuts
Lab Rat
164 posts

How did you create your database? I don’t see any mysql server either.

 Signature 

I’m a rebel in the S.D.G.

October 12, 2010

doforumda doforumda
Lab Rat
161 posts

well i download xampp and install it. i created database using phpmyadmin.

October 12, 2010

doforumda doforumda
Lab Rat
161 posts

i install xampp in this folder /opt/lampp

and my database is in /opt/lampp/var/mysql

October 12, 2010

lyuts lyuts
Lab Rat
164 posts

Ok, I see. What is the location of your XAMPP installation? try to find the mysql binary there. And use the whole path (since I assume it is not in PATH) when connecting, i.e.

  1. /path/to/xampp/bin/mysql -D dbname -u username

UPD: Didn’t notice the location of xampp. then try (I guess it would be like this)

  1. /opt/lampp/bin/mysql

 Signature 

I’m a rebel in the S.D.G.

October 12, 2010

doforumda doforumda
Lab Rat
161 posts

now here it what it says

  1. root@zafar-laptop:/# /opt/lampp/bin/mysql -D testTwo -h localhost -u root -p 123456
  2. Enter password:
  3. ERROR 1049 (42000): Unknown database '123456'

i am providing the right pw

October 12, 2010

lyuts lyuts
Lab Rat
164 posts

Try not passing -p switch. I guess you will be prompted to type in your password.
or

  1. /opt/lampp/bin/mysql -u root testTwo

 Signature 

I’m a rebel in the S.D.G.

October 12, 2010

doforumda doforumda
Lab Rat
161 posts

now it output is Access Denied

  1. root@zafar-laptop:/# /opt/lampp/bin/mysql -u root testTwo
  2. ERROR 1045 (28000): Access denied for user 'root'at'localhost' (using password: NO)

October 12, 2010

lyuts lyuts
Lab Rat
164 posts

I’m sorry i just confused you with my last post.

  1. /opt/lampp/bin/mysql -u root -p 123456 testTwo

I thought that mysql would prompt you but it didn’t.

 Signature 

I’m a rebel in the S.D.G.

October 12, 2010

¤ Dii ¤ ¤ Dii ¤
Lab Rat
48 posts

Do it this way, then it will prompt for a password:

  1. /opt/lampp/bin/mysql -D testTwo -h localhost -u root -p

October 12, 2010

doforumda doforumda
Lab Rat
161 posts

i got a big ouput here but i have not seen any errors in this. when i try to post whole output this forum didnt allow me to post more than 6000 characters

October 12, 2010

lyuts lyuts
Lab Rat
164 posts

Cut it into pieces or use something like pastebin.

 Signature 

I’m a rebel in the S.D.G.

October 12, 2010

doforumda doforumda
Lab Rat
161 posts

ok here it is

  1. root@zafar-laptop:/# /opt/lampp/bin/mysql -u root -p 123456 testTwo
  2. /opt/lampp/bin/mysql  Ver 14.14 Distrib 5.1.41, for pc-linux-gnu (i686) using  EditLine wrapper
  3. Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
  4. This software comes with ABSOLUTELY NO WARRANTY. This is free software,
  5. and you are welcome to modify and redistribute it under the GPL license
  6. Usage: /opt/lampp/bin/mysql [OPTIONS] [database]
  7.   -?, --help          Display this help and exit.
  8.   -I, --help          Synonym for -?
  9.   --auto-rehash       Enable automatic rehashing. One doesn't need to use
  10.                      'rehash' to get table and field completion, but startup
  11.                      and reconnecting may take a longer time. Disable with
  12.                      --disable-auto-rehash.
  13.  -A, --no-auto-rehash
  14.                      No automatic rehashing. One has to use 'rehash' to get
  15.                      table and field completion. This gives a quicker start of
  16.                      mysql and disables rehashing on reconnect. WARNING:
  17.                      options deprecated; use --disable-auto-rehash instead.
  18.  -B, --batch         Don't use history file. Disable interactive behavior.
  19.                       (Enables --silent)
  20.   --character-sets-dir=name
  21.                       Directory where character sets are.
  22.   --column-type-info  Display column type information.
  23.   -c, --comments      Preserve comments. Send comments to the server. The
  24.                       default is --skip-comments (discard comments), enable
  25.                       with --comments
  26.   -C, --compress      Use compression in server/client protocol.
  27.   -#, --debug[=#]     This is a non-debug version. Catch this and exit
  28.   --debug-check       Check memory and open file usage at exit.
  29.   -T, --debug-info    Print some debug info at exit.
  30.   -D, --database=name Database to use.
  31.   --default-character-set=name
  32.                       Set the default character set.
  33.   --delimiter=name    Delimiter to be used.
  34.   -e, --execute=name  Execute command and quit. (Disables --force and history
  35.                       file)
  36.   -E, --vertical      Print the output of a query (rows) vertically.
  37.   -f, --force         Continue even if we get an sql error.
  38.   -G, --named-commands
  39.                       Enable named commands. Named commands mean this program's
  40.                      internal commands; see mysql> help . When enabled, the
  41.                      named commands can be used from any line of the query,
  42.                      otherwise only from the first line, before an enter.
  43.                      Disable with --disable-named-commands. This option is
  44.                      disabled by default.
  45.  -g, --no-named-commands
  46.                      Named commands are disabled. Use \* form only, or use
  47.                      named commands only in the beginning of a line ending
  48.                      with a semicolon (;) Since version 10.9 the client now
  49.                      starts with this option ENABLED by default! Disable with
  50.                      '-G'. Long format commands still work from the first
  51.                      line. WARNING: option deprecated; use
  52.                      --disable-named-commands instead.
  53.  -i, --ignore-spaces Ignore space after function names.

October 12, 2010

doforumda doforumda
Lab Rat
161 posts

  1. --local-infile      Enable/disable LOAD DATA LOCAL INFILE.
  2.   -b, --no-beep       Turn off beep on error.
  3.   -h, --host=name     Connect to host.
  4.   -H, --html          Produce HTML output.
  5.   -X, --xml           Produce XML output
  6.   --line-numbers      Write line numbers for errors.
  7.   -L, --skip-line-numbers
  8.                       Don't write line number for errors. WARNING: -L is
  9.                      deprecated, use long version of this option instead.
  10.  -n, --unbuffered    Flush buffer after each query.
  11.  --column-names      Write column names in results.
  12.  -N, --skip-column-names
  13.                      Don't write column names in results. WARNING: -N is
  14.                       deprecated, use long version of this options instead.
  15.   -O, --set-variable=name
  16.                       Change the value of a variable. Please note that this
  17.                       option is deprecated; you can set variables directly with
  18.                       --variable-name=value.
  19.   --sigint-ignore     Ignore SIGINT (CTRL-C)
  20.   -o, --one-database  Only update the default database. This is useful for
  21.                       skipping updates to other database in the update log.
  22.   --pager[=name]      Pager to use to display results. If you don't supply an
  23.                      option the default pager is taken from your ENV variable
  24.                      PAGER. Valid pagers are less, more, cat [> filename],
  25.                      etc. See interactive help (\h) also. This option does not
  26.                      work in batch mode. Disable with --disable-pager. This
  27.                      option is disabled by default.
  28.  --no-pager          Disable pager and print to stdout. See interactive help
  29.                      (\h) also. WARNING: option deprecated; use
  30.                      --disable-pager instead.
  31.  -p, --password[=name]
  32.                      Password to use when connecting to server. If password is
  33.                      not given it's asked from the tty.
  34.   -P, --port=#        Port number to use for connection or 0 for default to, in
  35.                       order of preference, my.cnf, $MYSQL_TCP_PORT,
  36.                       /etc/services, built-in default (3306).
  37.   --prompt=name       Set the mysql prompt to this value.
  38.   --protocol=name     The protocol of connection (tcp,socket,pipe,memory).
  39.   -q, --quick         Don't cache result, print it row by row. This may slow
  40.                      down the server if the output is suspended. Doesn't use
  41.                       history file.
  42.   -r, --raw           Write fields without conversion. Used with --batch.
  43.   --reconnect         Reconnect if the connection is lost. Disable with
  44.                       --disable-reconnect. This option is enabled by default.
  45.   -s, --silent        Be more silent. Print results with a tab as separator,
  46.                       each row on new line.
  47.   -S, --socket=name   Socket file to use for connection.
  48.   --ssl               Enable SSL for connection (automatically enabled with
  49.                       other flags). Disable with --skip-ssl.
  50.   --ssl-ca=name       CA file in PEM format (check OpenSSL docs, implies
  51.                       --ssl).
  52.   --ssl-capath=name   CA directory (check OpenSSL docs, implies --ssl).
  53.   --ssl-cert=name     X509 cert in PEM format (implies --ssl).
  54.   --ssl-cipher=name   SSL cipher to use (implies --ssl).
  55.   --ssl-key=name      X509 key in PEM format (implies --ssl).
  56.   --ssl-verify-server-cert
  57.                       Verify server's "Common Name" in its cert against
  58.                      hostname used when connecting. This option is disabled by
  59.                      default.
  60.  -t, --table         Output in table format.
  61.  --tee=name          Append everything into outfile. See interactive help (\h)
  62.                      also. Does not work in batch mode. Disable with
  63.                      --disable-tee. This option is disabled by default.
  64.  --no-tee            Disable outfile. See interactive help (\h) also. WARNING:
  65.                      option deprecated; use --disable-tee instead
  66.  -u, --user=name     User for login if not current user.
  67.  -U, --safe-updates  Only allow UPDATE and DELETE that uses keys.
  68.  -U, --i-am-a-dummy  Synonym for option --safe-updates, -U.
  69.  -v, --verbose       Write more. (-v -v -v gives the table output format).
  70.  -V, --version       Output version information and exit.
  71.  -w, --wait          Wait and retry if connection is down.
  72.  --connect_timeout=# Number of seconds before connection timeout.
  73.  --max_allowed_packet=#
  74.                      Max packet length to send to, or receive from server
  75.  --net_buffer_length=#
  76.                      Buffer for TCP/IP and socket communication
  77.  --select_limit=#    Automatic limit for SELECT when using --safe-updates
  78.  --max_join_size=#   Automatic limit for rows in a join when using
  79.                      --safe-updates
  80.  --secure-auth       Refuse client connecting to server if it uses old
  81.                      (pre-4.1.1) protocol
  82.  --server-arg=name   Send embedded server this as a parameter.
  83.  --show-warnings     Show warnings after every statement.
  84.  
  85. Default options are read from the following files in the given order:
  86. /etc/xampp/my.cnf /opt/lampp/etc/my.cnf ~/.my.cnf
  87. The following groups are read: mysql client
  88. The following options may be given as the first argument:
  89. --print-defaults Print the program argument list and exit
  90. --no-defaults  Don't read default options from any options file
  91. --defaults-file=# Only read default options from the given file #
  92. --defaults-extra-file=# Read this file after the global files are read

October 12, 2010

doforumda doforumda
Lab Rat
161 posts

  1. Variables (--variable-name=value)
  2. and boolean options {FALSE|TRUE}  Value (after reading options)
  3. --------------------------------- -----------------------------
  4. auto-rehash                       FALSE
  5. character-sets-dir                (No default value)
  6. column-type-info                  FALSE
  7. comments                          FALSE
  8. compress                          FALSE
  9. debug-check                       FALSE
  10. debug-info                        FALSE
  11. database                          (No default value)
  12. default-character-set             latin1
  13. delimiter                         ;
  14. vertical                          FALSE
  15. force                             FALSE
  16. named-commands                    FALSE
  17. ignore-spaces                     FALSE
  18. local-infile                      FALSE
  19. no-beep                           FALSE
  20. host                              (No default value)
  21. html                              FALSE
  22. xml                               FALSE
  23. line-numbers                      TRUE
  24. unbuffered                        FALSE
  25. column-names                      TRUE
  26. sigint-ignore                     FALSE
  27. port                              3306
  28. prompt                            mysql>
  29. quick                             FALSE
  30. raw                               FALSE
  31. reconnect                         TRUE
  32. socket                            /opt/lampp/var/mysql/mysql.sock
  33. ssl                               FALSE
  34. ssl-ca                            (No default value)
  35. ssl-capath                        (No default value)
  36. ssl-cert                          (No default value)
  37. ssl-cipher                        (No default value)
  38. ssl-key                           (No default value)
  39. ssl-verify-server-cert            FALSE
  40. table                             FALSE
  41. user                              root
  42. safe-updates                      FALSE
  43. i-am-a-dummy                      FALSE
  44. connect_timeout                   0
  45. max_allowed_packet                16777216
  46. net_buffer_length                 16384
  47. select_limit                      1000
  48. max_join_size                     1000000
  49. secure-auth                       FALSE
  50. show-warnings                     FALSE

Page  
3

  ‹‹ [Solved]Color a QTableWidget cell      [solved] QTcpServer pause listening ››

You must log in to post a reply. Not a member yet? Register here!