安装mysql到服务器的linux环境下

时间:2023-12-27 08:43:31

1·安装mysql 命令:yum -y install httpd php mysql mysql-server

2·配置mysql

配置开机启动服务

/sbin/chkconfig --add mysqld [在服务清单中添加mysql服务]

/sbin/chkconfig mysqld on [设置mysql服务开机启动]

/sbin/service mysqld start [启动mysql服务,与开机无关]

设置mysql数据库root帐号密码:mysqladmin -u root password 'newpassword'

让mysql数据库更安全

mysql -u root -p

mysql> DROP DATABASE test; [删除test数据库]

mysql> DELETE FROM mysql.user WHERE user =''; [删除匿名帐户]

mysql> FLUSH PRIVILEGES; [重载权限]