torstai 26. syyskuuta 2013

Eclipse cannot create server problem and delete server

If you ever run to this problem that you cannot add Tomcat server to your Eclipse it is very easy to fix.

Go to Window–>Preferences–>Server–>Runtime Environments click edit and fix the broken path/link for the server. (Locate the Tomcat folder you have unzipped)

After that it should work.

Delete server

Right click servers from the left side menu, select delete and tick box delete from disk. Also from the bottom view of eclipse select servers and delete them there.

maanantai 23. syyskuuta 2013


Good page to train your SQL skills:

torstai 19. syyskuuta 2013

MySQL From Command line

If you have set up or you are going to use MySQL with SSH for example not via PHPMyadmin open your terminal and type

mysql -u username -p

Which means go to mysql, after -u put your username and -p is password, but do not enter your password after that it is going to ask it in the next prompt.

Enter your password (if you are using Putty press SHIFT + INSERT to paste)

Create new database:


To select database you want to use insert

use databasename;

to see what tables you have type

show tables;

To see what you have in the tables type

select * from tablename;

As you can see it works with same commands as phpmyadmin. If you want to add a table here is my example code:

CREATE TABLE Niki_Aanitteet(
artisti VARCHAR(255) NOT NULL,
levyn_nimi VARCHAR(255) NOT NULL

And to insert some data into the tables:

INSERT INTO Niki_Aanitteet(artisti, levyn_nimi) VALUES('PSY', 'Gangnam Style');
INSERT INTO Niki_Aanitteet(artisti, levyn_nimi) VALUES('Train', 'Drive By');
INSERT INTO Niki_Aanitteet(artisti, levyn_nimi) VALUES('Rihanna', 'Where Have You Been');

To see field, type, null, key, default, extra information type:
describe Niki_Aanitteet;

Create new user for your database and grant all privileges:

CREATE USER 'shnigi'@'localhost' IDENTIFIED BY 'passwordhere';

GRANT ALL PRIVILEGES ON * . * TO 'shnigi'@'localhost';

Explained bit better here:

create database testdatabase;
create user 'folio'@'localhost' identified by 'password123';

grant all privileges on testdatabase.* to 'folio'@'localhost' with grant option;