First, you need to install mysql under the centos system. I have already installed this, so I will not post the process here.
Step 1: Log in to the mysql database using the root user:
## Step 2: Create a mysql database. When the first step is successful in logging in, the mysql command will appear: mysql>## Step 3: Create a simple data table in the already created database
Step 4: Create a user for the database and grant permissions
Such a simple database has been created successfully. One thing to note is that after each mysql statement is written, a ; sign must be added, otherwise the statement will not be executed.
Possible errors during this process:
mysql> create database if not exists ipay_db;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
After successfully logging into mysql with root, such an error occurred. My solution is:
mysql> SET PASSWORD=PASSWORD('123!');
Query OK, 0 rows affected, 1 warning (0.00 sec)The above is the detailed content of Create database and user under centos7. For more information, please follow other related articles on the PHP Chinese website!