Dear iwalidza,
do you have a MySQL server set-up already? It can be placed either locally (recommended) or remotely, on another computer. You need to register a user with a secure password as well as a database for use with your resource. And how much experience do you have with MySQL databases in general?
You should use the official MTA database functions to connect to your configured MySQL server, in particular...
dbConnect - call it once at start of resource to initialize a database connection handle (you need a host, username and password, etc)
dbExec - creating new accounts into the MySQL database
dbQuery with dbPoll and dbFree - taking account information out of your database
In order to implement "This name already exists" you need to query the accounts SQL table on the "username" column and see if any row with that username already exists, for example...
SELECT * FROM accounts WHERE username="iwalidza"
If you were to use dbQuery on this statement in combination with dbPoll/dbFree you could check the existance of accounts prior to creating a double account.
I found an accounts system that claims to use MySQL under-the-hood in the MTA resources community: https://community.multitheftauto.com/index.php?p=resources&s=details&id=7263
Please take a look at it and compare it with what you want to implement.