标签:
一、通过yum自动安装mysql
yum install mysql-server my-client
二、初始化及相关配置
安装完mysql数据库以后,会发现会多出一个mysqld的服务,通过输入 service mysqld start 命令就可以启动mysql服务。
第一次启动会进行初始化配置,如下:
[root@yhb ~]# service mysqld start
初始化 MySQL 数据库: WARNING: The host ‘xiaoluo‘ could not be looked up with resolveip. This probably means that your libc libraries are not 100 % compatible with this binary MySQL version. The MySQL daemon, mysqld, should work normally with the exception that host name resolving will not work. This means that you should use IP addresses instead of hostnames when specifying MySQL privileges ! 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 xiaoluo 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!
[确定] 正在启动 mysqld: [确定]
想重启mysql,可以
[root@yhb ~]#service mysqld restart
设置开机自启动,命令为
[root@yhb ~]#chkconfig mysqld on
为root用户设置密码,这里的root是指mysql的root用户,不是Linux系统的root用户,命令为
[root@yhb ~]#mysqladmin -u root password ‘root‘ //通过命令给root账号设置密码为root
然后就可以通过mysql -u root -p命令来登录mysql数据库了,然后输入密码登陆即可。
三、mysql数据的主要配置文件
标签:
原文地址:http://www.cnblogs.com/longzhongren/p/4262784.html