Avatar billede je79ayps Novice
24. april 2003 - 20:45 Der er 13 kommentarer og
1 løsning

MySQL og oprettelse af database

Jeg har lige fulgt webcafe.dk's guide i installation af MySQL og phpMyAdmin, men efter at jeg har sat mit kodeord i config.inc.php får jeg fejlen: "Access denied for user: 'root@127.0.0.1' (Using password: YES)".

Er det fordi jeg mangler at oprette en database og i så fald hvordan gør jeg det?
Avatar billede erikjacobsen Ekspert
24. april 2003 - 20:47 #1
Hvilket password bruger du? Har du selv sat det for root?
Avatar billede simonvalter Praktikant
24. april 2003 - 20:49 #2
password er blank til at starte med!
Avatar billede simonvalter Praktikant
24. april 2003 - 20:51 #3
sæt et password med mysql client

mysql -u root -p<enter>
enter pass:<enter>

mysql> SET PASSWORD FOR root = PASSWORD('secret');
quit;
Avatar billede simonvalter Praktikant
24. april 2003 - 20:52 #4
så kan du sætte phpmyadmin op ..

og husk at lave en kontrol bruger .. ikke root/pass

GRANT USAGE ON mysql.* TO 'kontrolle'@'localhost' IDENTIFIED BY 'lemme1n';
GRANT SELECT (Host, User, Select_priv, Insert_priv, Update_priv, Delete_priv,
Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv,
Grant_priv, References_priv, Index_priv, Alter_priv) ON mysql.user TO
'kontrolle'@'localhost';
GRANT SELECT ON mysql.db TO 'kontrolle'@'localhost';
GRANT SELECT (Host, Db, User, Table_name, Table_priv, Column_priv) ON
mysql.tables_priv TO 'kontrolle'@'localhost';
\q
Avatar billede simonvalter Praktikant
24. april 2003 - 20:53 #5
skift kontrolle/lemme1n med noget du selv finder på.
Avatar billede je79ayps Novice
24. april 2003 - 20:55 #6
OK, hvis ikke jeg sætter noget kodeord får jeg denne:

$cfg['PmaAbsoluteUri'] direktivet SKAL være sat i konfigurationsfilen!

Your configuration file contains settings (root with no password) that correspond to the default MySQL privileged account. Your MySQL server is running with this default, is open to intrusion, and you really should fix this security hole.

loadet>> hvor skal jeg køre de der kommandoer henne - i DOS?
Avatar billede simonvalter Praktikant
24. april 2003 - 20:58 #7
ja feks .. hvis det er på windows kan du vel køre en mysql.exe i cmd.exe

og $cfg['PmaAbsoluteUri'] er bare "http://ditdomain.dk/phpmyadmin ... eller hvor den nu ligger
Avatar billede je79ayps Novice
24. april 2003 - 21:39 #8
OK, så blev "$cfg['PmaAbsoluteUri'] direktivet SKAL være sat i konfigurationsfilen!" fejlen fjernet.

Men jeg får stadig den anden fejl med "Access denied..." Jeg har kørt denne: "mysql> SET PASSWORD FOR root = PASSWORD('secret');" og så udskiftet secret med mit eget kodeord hvorefter den sagde "Query OK, 0 rows affected (0.16 sec)" - var det ikke sådan?
Avatar billede simonvalter Praktikant
24. april 2003 - 21:54 #9
jo ..
men har du også tilføjet kontrol brugen og sat settings for ham op i phpmyadmin config filen ..
Avatar billede je79ayps Novice
24. april 2003 - 21:58 #10
Nej, kontrolle er det den bruger jeg selv vil vælge - eks. je79ayps? Og hvad med lemme1n er det kodeordet?
Avatar billede simonvalter Praktikant
24. april 2003 - 22:30 #11
ja
Avatar billede je79ayps Novice
25. april 2003 - 17:57 #12
OK, så har jeg kørt denne:

GRANT USAGE ON mysql.* TO 'je79ayps'@'localhost' IDENTIFIED BY 'secret';
GRANT SELECT (Host, User, Select_priv, Insert_priv, Update_priv, Delete_priv,
Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv,
Grant_priv, References_priv, Index_priv, Alter_priv) ON mysql.user TO
'je79ayps'@'localhost';
GRANT SELECT ON mysql.db TO 'je79ayps'@'localhost';
GRANT SELECT (Host, Db, User, Table_name, Table_priv, Column_priv) ON
mysql.tables_priv TO 'je79ayps'@'localhost';
\q

Det gav så følgende resultat:

Microsoft Windows XP [version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.


C:\mysql\bin>mysql GRANT USAGE ON mysql.* TO 'je79ayps'@'localhost' IDENTIFIED B
Y 'secret';
mysql  Ver 12.18 Distrib 4.0.12, for Win95/Win98 (i32)
Copyright (C) 2002 MySQL AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Usage: mysql [OPTIONS] [database]
  -?, --help          Display this help and exit.
  --auto-rehash      Enable automatic rehashing. One doesn't need to use
                      'rehash' to get table and field completion, but startup
                      and reconnecting may take a longer time. Disable with
                      --disable-auto-rehash.
  -A, --no-auto-rehash
                      No automatic rehashing. One has to use 'rehash' to get
                      table and field completion. This gives a quicker start of
                      mysql and disables rehashing on reconnect. WARNING:
                      options deprecated; use --disable-auto-rehash instead.
  -B, --batch        Print results with a tab as separator, each row on new
                      line. Doesn't use history file.
  --character-sets-dir=name
                      Directory where character sets are.
  --default-character-set=name
                      Set the default character set.
  -C, --compress      Use compression in server/client protocol.
  -D, --database=name Database to use.
  -e, --execute=name  Execute command and quit. (Output like with --batch).
  -E, --vertical      Print the output of a query (rows) vertically.
  -f, --force        Continue even if we get an sql error.
  -g, --no-named-commands
                      Named commands are disabled. Use \* form only, or use
                      named commands only in the beginning of a line ending
                      with a semicolon (;) Since version 10.9 the client now
                      starts with this option ENABLED by default! Disable with
                      '-G'. Long format commands still work from the first
                      line. WARNING: option deprecated; use
                      --disable-named-commands instead.
  -G, --named-commands
                      Enable named commands. Named commands mean this program's
                      internal commands; see mysql> help . When enabled, the
                      named commands can be used from any line of the query,
                      otherwise only from the first line, before an enter.
                      Disable with --disable-named-commands. This option is
                      disabled by default.
  -i, --ignore-spaces Ignore space after function names.
  --local-infile      Enable/disable LOAD DATA LOCAL INFILE.
  -b, --no-beep      Turn off beep on error.
  -h, --host=name    Connect to host.
  -H, --html          Produce HTML output.
  -X, --xml          Produce XML output
  --line-numbers      Write line numbers for errors.
  -L, --skip-line-numbers
                      Don't write line number for errors. WARNING: -L is
                      deprecated, use long version of this option instead.
  --no-tee            Disable outfile. See interactive help (\h) also. WARNING:
                      option deprecated; use --disable-tee instead
  -n, --unbuffered    Flush buffer after each query.
  --column-names      Write column names in results.
  -N, --skip-column-names
                      Don't write column names in results. WARNING: -N is
                      deprecated, use long version of this options instead.
  -O, --set-variable=name
                      Change the value of a variable. Please note that this
                      option is deprecated; you can set variables directly with
                      --variable-name=value.
  -o, --one-database  Only update the default database. This is useful for
                      skipping updates to other database in the update log.
  -p, --password[=name]
                      Password to use when connecting to server. If password is
                      not given it's asked from the tty.
  -W, --pipe          Use named pipes to connect to server.
  -P, --port=#        Port number to use for connection.
  --prompt=name      Set the mysql prompt to this value.
  -q, --quick        Don't cache result, print it row by row. This may slow
                      down the server if the output is suspended. Doesn't use
                      history file.
  -r, --raw          Write fields without conversion. Used with --batch
  -s, --silent        Be more silent.
  -S, --socket=name  Socket file to use for connection.
  -t, --table        Output in table format.
  -T, --debug-info    Print some debug info at exit.
  --tee=name          Append everything into outfile. See interactive help (\h)
                      also. Does not work in batch mode.
  -u, --user=name    User for login if not current user.
  -U, --safe-updates  Only allow UPDATE and DELETE that uses keys.
  -U, --i-am-a-dummy  Synonym for option --safe-updates, -U.
  -v, --verbose      Write more. (-v -v -v gives the table output format)
  -V, --version      Output version information and exit.
  -w, --wait          Wait and retry if connection is down.
  --connect_timeout=#
  --max_allowed_packet=#
  --net_buffer_length=#
  --select_limit=#
  --max_join_size=#

Default options are read from the following files in the given order:
C:\WINDOWS\my.ini C:\my.cnf
The following groups are read: mysql client
The following options may be given as the first argument:
--print-defaults        Print the program argument list and exit
--no-defaults          Don't read default options from any options file
--defaults-file=#      Only read default options from the given file #
--defaults-extra-file=# Read this file after the global files are read

Variables (--variable-name=value)
and boolean options {FALSE|TRUE}  Value (after reading options)
--------------------------------- -----------------------------
auto-rehash                      TRUE
character-sets-dir                (No default value)
default-character-set            (No default value)
compress                          FALSE
database                          (No default value)
vertical                          FALSE
force                            FALSE
named-commands                    FALSE
local-infile                      FALSE
no-beep                          FALSE
host                              (No default value)
html                              FALSE
xml                              FALSE
line-numbers                      TRUE
unbuffered                        FALSE
column-names                      TRUE
port                              3306
prompt                            mysql>
quick                            FALSE
raw                              FALSE
socket                            (No default value)
table                            FALSE
debug-info                        FALSE
user                              (No default value)
safe-updates                      FALSE
i-am-a-dummy                      FALSE
connect_timeout                  0
max_allowed_packet                16777216
net_buffer_length                16384
select_limit                      1000
max_join_size                    1000000

C:\mysql\bin>GRANT SELECT (Host, User, Select_priv, Insert_priv, Update_priv, De
lete_priv,
'GRANT' blev ikke genkendt som en intern eller ekstern kommando,
et program eller en batchfil.

C:\mysql\bin>Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, F
ile_priv,
'Create_priv' blev ikke genkendt som en intern eller ekstern kommando,
et program eller en batchfil.

C:\mysql\bin>Grant_priv, References_priv, Index_priv, Alter_priv) ON mysql.user
TO
'Grant_priv' blev ikke genkendt som en intern eller ekstern kommando,
et program eller en batchfil.

C:\mysql\bin>'je79ayps'@'localhost';
''je79ayps'@'localhost'' blev ikke genkendt som en intern eller ekstern kommando
,
et program eller en batchfil.

C:\mysql\bin>GRANT SELECT ON mysql.db TO 'je79ayps'@'localhost';
'GRANT' blev ikke genkendt som en intern eller ekstern kommando,
et program eller en batchfil.

C:\mysql\bin>GRANT SELECT (Host, Db, User, Table_name, Table_priv, Column_priv)
ON
'GRANT' blev ikke genkendt som en intern eller ekstern kommando,
et program eller en batchfil.

C:\mysql\bin>mysql.tables_priv TO 'je79ayps'@'localhost';
'mysql.tables_priv' blev ikke genkendt som en intern eller ekstern kommando,
et program eller en batchfil.

C:\mysql\bin>\q

Det er vel ikke helt efter planen?
Avatar billede je79ayps Novice
01. maj 2003 - 19:53 #13
loadet>> læg lige et svar for forsøget.
Avatar billede je79ayps Novice
10. maj 2003 - 09:12 #14
Lukker.
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Computerworld tilbyder specialiserede kurser i database-management

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester