安装
yum install mysql mysql-server
启动
service mysqld start
启动提示如下
Initializing MySQL database: Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h iZ2ze4ix88haxa5rspk7mwZ password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
[ OK ]
Starting mysqld: [ OK ]
首次密码设置命令
mysqladmin -u root -p 密码
更改密码命令
mysqladmin -u root -p password 新密码
命令回车后会问你旧密码
mysql默认只允许本地用户连接,开启远程连接方法:
允许root用户允许远程连接mysql数据库
grant all privileges on *.* to 'root'@'%' identified by 'root的密码' with grant option;
flush privileges;
设置开机启动mysql
systemctl enable mysqld
查看mysql 当前状态
systemctl status mysqld