Centos6.5 安装MySQL
来自CloudWiki
安装配置MySQL
安装mysql
安装mysql,并设置mysql开机自启动
yum install mysql yum install mysql-server chkconfig --levels 35 mysqld on service mysqld start
配置mysql的root密码
mysql_secure_installation Enter current password for root (enter for none): ( 回车) OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. Set root password? [Y/n] (Y) //注意,这里输入密码是不回显的 New password: (000000) Re-enter new password: (000000) Password updated successfully! Reloading privilege tables.. ... Success! By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. (是否移出数据库的默认帐户,如果移出,那么在终端中直接输入mysql是会提示连接错误的) Remove anonymous users? [Y/n](n) Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] (是否禁止root的远程登录)n By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] n Reload privilege tables now? [Y/n] Y
登录mysql数据库
- mysql -uroot -p
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | +--------------------+ 3 rows in set (0.00 sec) mysql> exit; Bye