7、启动mysql服务
[root@cdh1 zjl]# 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 cdh1.zjl.com password 'new-password'Alternatively you can run:/usr/bin/mysql_secure_installationwhich 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 ]
8、连接一下试一下,直接mysql然后\q关闭连接
[root@cdh1 zjl]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2Server version: 5.1.73 Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> \q Bye
9、设置mysql开机启动
[root@cdh1 zjl]# chkconfig mysqld on
10、开启3306端口,并保存
[root@cdh1 zjl]# /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT [root@cdh1 zjl]# /etc/rc.d/init.d/iptables save
11、连接mysql设置密码
[root@cdh1 zjl]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3Server version: 5.1.73 Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> update user set password=password('123') where user='root'; Query OK, 3 rows affected (0.02 sec) Rows matched: 3 Changed: 3 Warnings: 0mysql> flush privileges; Query OK, 0 rows affected (0.02 sec) mysql> \q Bye
12、重启mysql服务
[root@cdh1 zjl]# service mysqld restart Stopping mysqld: [ OK ] Starting mysqld: [ OK ]
以上就是centos 6.9安装mysql的实例教程的详细内容,更多请关注php中文网其它相关文章!
……