Luxoft / Twister

Twister Test Automation Framework
http://www.twistertesting.com/
Apache License 2.0
38 stars 21 forks source link

Twister-installation : Create Database error #135

Closed twistUser1 closed 10 years ago

twistUser1 commented 10 years ago

Hello,

Am newbie to twister tool. Downloaded the twister zip from gitbhub and also Twister User Guide. Followed the steps for installation, but struck with a error while Creating database

User Guide says as below :-

Create database “twister_demo” and table “results” using file twister/installer/packages/twister_demo.sql file ( mysql < twister/installer/packages/twister_demo.sql)

I did the same as above, but thrown with an error as pasted down

$ mysql twister_demo.sql ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'twister_demo.sql'

$ whoami user $ $ pwd /home/user/Twister-git_hub_branch/Twister-git_hub_branch/installer/packages $

I am a newbie to these mysql too.. could not understand the error. Tried some googling, but not much help.

Can anyone guide me to get unblocked here...

Thanks a lot. :-)

bogdanpopescu commented 10 years ago

@twistUser1 Try to create the database as root mysql -u root < twister/installer/packages/twister_demo.sql

twistUser1 commented 10 years ago

Thanks , but no luck... $ mysql -u root twister_demo.sql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) $

bogdanpopescu commented 10 years ago

@twistUser1 It means that you set a password for root, do it like mysql -u root -p < twister/installer/packages/twister_demo.sql

It will ask you for the root password. That should work.

twistUser1 commented 10 years ago

I did it and entered the password too. But still it failed for me. $ mysql -u root -p twister_demo.sql Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) $

I tried it even with sudo $ sudo mysql twister_demo.sql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) $

The user "user" is already in sudoers lists. Just to cross-check, i ran the below command. $ sudo ls bkup_twister_demo.sql.bkup Mako-0.9.1.tar.gz pExpect-3.1.tar.gz rpyc.tar.gz six-1.6.1.tar.gz CherryPy-3.2.2.tar.gz MySQL-python-1.2.3.tar.gz plumbum-1.4.1.tar.gz Scapy-real-2.2.0-dev.tar.gz twister_demo.sql LXML-Python-3.2.1.tgz paramiko-1.12.2.tar.gz PyCrypto-2.6.tar.gz setuptools-3.4.1.tar.gz $

bogdanpopescu commented 10 years ago

@twistUser1 Ok, you need to sort out first why you cannot access mysql database, meaning that command mysql -u root -p doesn't return you any error and you are able to get the mysql prompt. Please make sure you are using the correct mysql root password, it might be different than the Linux password.

twistUser1 commented 10 years ago

I sorted out for the access mysql database. But the original problem is not yet resolved but a different error message :-

$ $ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 44 Server version: 5.5.24-0ubuntu0.12.04.1 (Ubuntu)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> mysql> mysql> mysql> Bye $ $ $ mysql -u root -p twister_demo.sql Enter password: ERROR 1049 (42000): Unknown database 'twister_demo.sql' $ $ $

bogdanpopescu commented 10 years ago

@twistUser1 Ok, so you can connect ot mysql. To import twister_demo.sql, you need to redirect it to mysql using < . So the correct command is: mysql -u root -p < twister_demo.sql

twistUser1 commented 10 years ago

Thanks. Before your latest advise, i was trying some alternatives to solve the problem :

$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 48 Server version: 5.5.24-0ubuntu0.12.04.1 (Ubuntu)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> source /home/user/Twister-git_hub_branch/Twister-git_hub_branch/installer/packages/twister_demo.sql Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 1 row affected (0.00 sec)

Database changed Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.07 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) mysql> Bye

Later after your email, i tried your advise $ mysql -u root -p < twister_demo.sql Enter password: ERROR 1007 (HY000) at line 22: Can't create database 'twister_demo'; database exists $

By this result, i guess we could complete it. anyway to check if database creation and table are as expected ?

bogdanpopescu commented 10 years ago

@twistUser1 The DB was created when you did the source command. To verify, you can login using 'user' account. mysql -u user -p Enter 'password' when prompted for password. At mysql prompt, do: use twister_demo; - to select the imported DB

mysql> show tables; +------------------------+ | Tables_in_twister_demo | +------------------------+ | results | +------------------------+ 1 row in set (0.00 sec)

mysql> describe results; +------------------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------------+------------------+------+-----+---------+----------------+ | id | int(10) unsigned | NO | PRI | NULL | auto_increment | | run_nb | int(10) | YES | | NULL | | | suite_id | int(10) | YES | | NULL | | | tc_id | int(10) | YES | | NULL | | | username | varchar(32) | YES | | NULL | | | ce_hostname | varchar(32) | YES | | NULL | | | ce_ip | varchar(32) | YES | | NULL | | | ep_ip | varchar(32) | YES | | NULL | | | ep_hostname | varchar(32) | YES | | NULL | | | ep_name | varchar(32) | YES | | NULL | | | suite_name | varchar(32) | YES | | NULL | | | tc_name | varchar(32) | YES | | NULL | | | tc_path | varchar(256) | YES | | NULL | | | tc_status | varchar(32) | YES | | NULL | | | tc_time_elapsed | varchar(32) | YES | | NULL | | | tc_date_started | varchar(32) | YES | | NULL | | | tc_date_finished | varchar(32) | YES | | NULL | | | tc_log | blob | YES | | NULL | | +------------------+------------------+------+-----+---------+----------------+ 18 rows in set (0.00 sec)

mysql>

twistUser1 commented 10 years ago

i got the below response. Though i did not get the same output as yours, i got a similar. Hope I can continue with the next step of Twister installation.

mysql> use twister_demo; Database changed mysql> show tables -> ; +------------------------+ | Tables_in_twister_demo | +------------------------+ | results | +------------------------+ 1 row in set (0.00 sec)

mysql> descripfsdaf; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'descripfsdaf' at line 1 mysql> describe results; +------------------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------------+------------------+------+-----+---------+----------------+ | id | int(10) unsigned | NO | PRI | NULL | auto_increment | | run_nb | int(10) | YES | | NULL | | | username | varchar(32) | YES | | NULL | | | ce_hostname | varchar(32) | YES | | NULL | | | ce_ip | varchar(32) | YES | | NULL | | | ep_ip | varchar(32) | YES | | NULL | | | ep_hostname | varchar(32) | YES | | NULL | | | ep_name | varchar(32) | YES | | NULL | | | suite_name | varchar(32) | YES | | NULL | | | tc_name | varchar(32) | YES | | NULL | | | tc_path | varchar(256) | YES | | NULL | | | tc_status | varchar(32) | YES | | NULL | | | tc_time_elapsed | varchar(32) | YES | | NULL | | | tc_date_started | varchar(32) | YES | | NULL | | | tc_date_finished | varchar(32) | YES | | NULL | | | tc_log | blob | YES | | NULL | | +------------------+------------------+------+-----+---------+----------------+ 16 rows in set (0.00 sec)

mysql>