In Order to set up a new MySQL Database and a user on a linux server you need do the following steps.
E.g. to install MySQL on a debian Linux, e.g. Etch 4.0, you first install the MySQL demon package by using apt-get:
linux.shell> apt-get install mysql-server linux.shell> apt-get install mysql-client
Login as MySQL administrator with the command:
linux.shell> mysql -u root -p
The shell should prompt “mysql> “. “-u” announces the following user “root”, “-p” prompts the question for the password.
Take a look at the databases by tipping
linux.shell> show databases;
hint: the Semikolon “;” at the end of the command is important, the server interpretes this as end of the command.
to set up a new database use the command
linux.shell> create database YOUR_DATABASENAME;
Set up a User and take care to type in the ‘ in your linux.shell>
create user YOUR_USERNAME@localhost; set password for YOUR_USERNAME@localhost = password('YOUR_PASSWORD'); grant ALL on YOUR_DATABASENAME.* to YOUR_USERNAME@localhost;
Explanation: These commands assign the User to the database.
Tipp: Do it shorter by
GRANT ALL PRIVILEGES ON DATABASENAME.* TO 'USERNAME'@'localhost' IDENTIFIED BY 'PASSWORD';
Step 1: Set up a new user for localhost access only. Replaye localhost by a domain by example in order to restrict the user access to that domain.
Step 2: Set the Password for the User. Do not forget the ‘.
Step 3: Give the User all rights by using “ALL”. You may differentiate “ALL” by optionally using: “SELECT, INSERT, UPDATE, DELETE, CREATE, DROP”
thats it. Your Database is ready to use. For example to install wordpress.
1 thought on “Create new MySQL database and new user”