[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [TEKNIK] Automatisk fremstilling af MySQL Databaser som root i BASH



Se i bunden :)

T

"Martin Møller Skarbiniks Pedersen" skrev i meddelelsen news:sslug@sslug

2011/4/17 Thomas Rosendal Jensen <sslug@sslug>:
Martin Møller Skarbiniks Pedersen wrote:

Du skal angive mysql brugeren roots password med -p
P.t. angiver du jo bare et tilfældigt password.

Det må være sådan du mener:

 mysqladmin create ${UNDERSCORENAME} -uroot
-p"MySQL_administratorens_kodeord"

Jeg har dog brug for at have en brugers konto tilknyttet mysqladmin.

Kan det gøres sådan?:
mysqladmin create ${UNDERSCORENAME} -u${USRNME} -p"pzs1CyM5tRJYcw"

Nej overhovedet ikke. mysqladmin create bruges til at skabe en ny
database. Den kan ikke bruges til at skabe en ny bruger.

Og for at bruge mysqladmin skal man med -u angive en mysql-bruger, der
har rettigheder nok til operationen og med -p angive samme brugers
password.

For at oprette en ny $USRNME i mysql, som skal have adgang til en
database der hedder $UNDERSCORENAME i et shell-script kan du bruge:

mysql -uroot -p<mysql-roots password> << EOT
create user \'$USRNME\' identified by \'pzs1CyM5tRJYcw\';
grant all privileges on \'$UNDERSCORENAME\'.* to \'$USRNME \'@\'localhost\';
exit;
EOT

MVh
Martin

Nu har gjort noget du godt vil bryde dig om.
Jeg har bestilt følgende bog fra eLounge.dk :)

Vare nr Titel Antal Pris Total Beløb
0596526784 bash Cookbook 1 310,94 310,94

Thomas

 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2011-05-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *