mysql initialization

Start mysql server:
/usr/sbin/service mysqld start

Check the root password:
$sudo grep 'temporary password' /var/log/mysqld.log

2019-03-30T12:44:15.258452Z 1 [Note] A temporary password is generated for root@localhost: ZK3<r.j5H;o?

Change the password immediately:
$mysql -u root -p

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'PseudoTest@';

Create a user named with cdctest
mysql> CREATE USER cdctest IDENTIFIED BY 'Pseudo4UI@';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'cdctest'@'localhost' IDENTIFIED BY 'PseudoTest@';

$mysql -u cdctest -p

Create a new database named with "GATEST"
mysql> CREATE DATABASE gatest;
msql> use gatest;

Restart the databse from the file:
$mysql -u cdctest -p --database=gatest < gatest-mysql.sql

猜你喜欢

转载自www.cnblogs.com/learn-everyday/p/10634346.html