Difference between revisions of "MySQL"

From Alessandro's Wiki
 
Line 1: Line 1:
=== Problemi ===
== Problemi ==
* Un bel giorno ho avuto un problema...
* Un bel giorno ho avuto un problema...


Line 11: Line 11:
  chown -R mysql:mysql /var/run/mysql
  chown -R mysql:mysql /var/run/mysql


=== SQL ===
== SQL ==


mysql -s -N -B -u user -p -D amarokdb -e "SELECT path FROM images"
for a in `mysql -s -N -B -u user -p -D db -e "SELECT path FROM images"`; do cp -v "$a" /var/www/localhost/htdocs/media/covers/; done
=== Grant ===
  GRANT priv_type [(column_list)] [, priv_type [(column_list)]] ...
  GRANT priv_type [(column_list)] [, priv_type [(column_list)]] ...
     ON [object_type] {tbl_name | * | *.* | db_name.*}
     ON [object_type] {tbl_name | * | *.* | db_name.*}
Line 24: Line 29:
         [SUBJECT 'subject']]
         [SUBJECT 'subject']]
     [WITH with_option [with_option] ...]
     [WITH with_option [with_option] ...]
GRANT SELECT ON test.* TO 'nagios'@'localhost'  IDENTIFIED BY 'la password che vuoi';

Revision as of 23:14, 15 January 2007

Problemi

  • Un bel giorno ho avuto un problema...
    • errori in /var/log/messages:
061013 18:14:58 [ERROR] Can t start server : Bind on unix socket: Permission denied
061013 18:14:58 [ERROR] Do you already have another mysqld server running on socket: //var/run/mysqld/mysqld7415.sock ?
061013 18:14:58 [ERROR] Aborting
    • si risolve con
chown -R mysql:mysql /var/lib/mysql
chown -R mysql:mysql /var/run/mysql

SQL

mysql -s -N -B -u user -p -D amarokdb -e "SELECT path FROM images"
for a in `mysql -s -N -B -u user -p -D db -e "SELECT path FROM images"`; do cp -v "$a" /var/www/localhost/htdocs/media/covers/; done


Grant

GRANT priv_type [(column_list)] [, priv_type [(column_list)]] ...
   ON [object_type] {tbl_name | * | *.* | db_name.*}
   TO user [IDENTIFIED BY [PASSWORD] 'password']
       [, user [IDENTIFIED BY [PASSWORD] 'password']] ...
   [REQUIRE
       NONE |
       [{SSL| X509}]
       [CIPHER 'cipher' [AND]]
       [ISSUER 'issuer' [AND]]
       [SUBJECT 'subject']]
   [WITH with_option [with_option] ...]
GRANT SELECT ON test.* TO 'nagios'@'localhost'  IDENTIFIED BY 'la password che vuoi';