| View previous topic :: View next topic |
| Author |
Message |
thiagocv n00b


Joined: 20 Jun 2005 Posts: 35 Location: Brasil
|
Posted: Mon Oct 17, 2005 12:08 pm Post subject: dúvida acesso a mysql |
|
|
Caros amigos, estou tentando fazer um script perl inserir dados no mysql.
A partir do meu Package CD, instalei o pacote do mysql e os pacotes DBI-1.38-r1.tbz2 e perl-ldap-0.31.tbz2 da pasta dev-perl. Acho que o DBI é o módulo para o perl conversar com o banco. Tinha mais todos esses:
Convert-ASN1-0.17.tbz2, Crypt-SmbHash-0.02.tbz2, DBD-mysql-2.1027.tbz2, DBI-1.38-r1.tbz2, DB_File-1.807.tbz2, Digest-HMAC-1.01-r1.tbz2, Digest-MD4-1.3.tbz2, Digest-MD5-2.33.tbz2, Digest-SHA1-2.07.tbz2, HTML-Parser-3.34-r1.tbz2, HTML-Tagset-3.03-r2.tbz2, IO-Socket-SSL-0.96.tbz2, MIME-Base64-3.05.tbz2, Net-DNS-0.40.tbz2, Net-Daemon-0.37.tbz2, Net-SSLeay-1.23.tbz2, PlRPC-0.2016-r1.tbz2, PodParser-1.28.tbz2, SGMLSpm-1.03-r5.tbz2, Storable-2.07-r1.tbz2, URI-1.35.tbz2, XML-Parser-2.34.tbz2, digest-base-1.05.tbz2, perl-ldap-0.31.tbz2.
bash-2.05b# emerge -K <pacote>
*** emerging by path is broken add may not always work!!!
Acho que esse alerta aparece sempre, né? Calculou as dependências e ok.
bash-2.05b# /usr/bin/mysql_install_dbUm amigo me falou para dar o comando acima, mas eu não instalei com o primeiro comando?
Parece que instalou normalmente.
Aí, iniciei o MySQL:
bash-2.05b# /etc/init.d/mysql start
* Starting mysqld... [ok]
bash-2.05b# mysql
ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)Tentei mudar a senha do usurio root:
bash-2.05b# /usr/bin/mysqladmin -u root password tcv123
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: NO)'
bash-2.05b# /usr/bin/mysqladmin -u root@localhost password tcv123
/usr/bin/mysqladmin: unable to change password; error: 'Access denied for user: '@localhost' to database 'mysql''
bash-2.05b# /usr/bin/mysqltest
/usr/bin/mysqltest: Failed in mysql_real_connect(): Access denied for user: 'root@localhost' (Using password: NO)
Será que eu não posso usar o root? _________________ Thiago Cesar Vieira
http:\\thiago.gentux.com.br |
|
| Back to top |
|
 |
RoadRunner Moderator


Joined: 12 Jun 2002 Posts: 490 Location: Coimbra, Portugal
|
Posted: Mon Oct 17, 2005 10:47 pm Post subject: |
|
|
| Devias ter prestado atenção ao final do emerge que te diz o que fazer. deves fazer o comando ebuild /var/db/pkg/dev-db/mysql/mysql{versão do mysql aqui} config |
|
| Back to top |
|
 |
thiagocv n00b


Joined: 20 Jun 2005 Posts: 35 Location: Brasil
|
Posted: Tue Oct 18, 2005 12:28 pm Post subject: cara! que complicado!! |
|
|
Valeu Runner!
Dei esse comando que vc falou:
bash-2.05b# ebuild /var/db/pkg/dev-db/mysql-4.0.24/mysql-4.0.24.ebuild config
* MySQL DATADIR is /var/lib/mysql
* Hmm, it appears as though you already have the mysql database in place. If you are having problems trying
* to start mysqld, perhaps you need to manually run /usr/bin/mysql_install_db and/or check your config
* file(s) and/or database(s) and/or logfile(s).
Aí:
bash-2.05b# mysql_install_db
WARNING: The host 'tcv' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible with this binary MySQL version. The MySQL daemon, mysqld, should work normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames when specifying MySQL privileges !
Installing all prepared tables
To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, issue the following commands to start the server and change the applicable passwords:
/etc/init.d/mysql start
/usr/bin/mysqladmin -u root -h tcv password 'new-password'
/usr/bin/mysqladmin -u root password 'new-password'
Depending on your configuration, a -p option may be needed
in the last command. See the manual for more details.
NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run
the /usr/bin/mysql_fix_privilege_tables. Otherwise you will not be
able to use the new GRANT command!
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com
bash-2.05b# /etc/init.d/mysql start
* Starting mysqld... [ ok ]
Testando os privilégios iniciais:
bash-2.05b# mysql -u root test
ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)
Consultei no google sobre esse problema e Pediram para conferir se existe o arquivo user.MYD do diretório do MySQL.
Pesquisei pelo mesmo na máquina e o encontrei na pasta /var/lib/mysql/mysql
Dei um nano no arquivo, mas têm caracteres indecifráveis. As únicas coisas que identifiquei são o root e tcv outro usuário.
Caros amigos, o que falta-me fazer? Vcs têm alguma idéia?
Muito obrigado pela atenção. _________________ Thiago Cesar Vieira
http:\\thiago.gentux.com.br |
|
| Back to top |
|
 |
RoadRunner Moderator


Joined: 12 Jun 2002 Posts: 490 Location: Coimbra, Portugal
|
Posted: Wed Oct 19, 2005 1:09 am Post subject: |
|
|
| O problema é que tu usaste um script de criação de uma base de dados mysql sem no entanto especificares uma password. Podes tentar 1) remover completamente o mysql e reinstalar a partir do zero, 2) efectuar o reset da password de root como está documentado no site do mysql. |
|
| Back to top |
|
 |
To Veteran


Joined: 12 Apr 2003 Posts: 1145 Location: Coimbra, Portugal
|
Posted: Wed Oct 26, 2005 8:26 am Post subject: |
|
|
Já agora, habitua-te a fazeres isto assim:
| Code: | | bash-2.05b# mysql -u root -p test |
Tó _________________
------------------------------------------------
Linux Gandalf 3.2.35-grsec
Gentoo Base System version 2.2
------------------------------------------------ |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|