sql.com
?
Support MySQL by buying support/licenses at http://shop.mysql.com
?
New default config file was created as /usr/local/mysql/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
?
WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
?
--defaults-file argument to mysqld_safe when starting the server
?
[root@localhost ~]# cp support-files/mysql.server /etc/init.d/mysqld
[root@localhost ~]# chmod 755 /etc/init.d/mysqld
查看mysqld服务是否设置为开机启动
[root@localhost ~]# chkconfig --list|grep mysqld
设置为开机启动
[root@localhost ~]# chkconfig mysqld on
启动mysql数据库,会输出一系列有用的信息,告诉你接下去如何初始化mysql
[root@CentOS mysql]# service mysqld start
按照上述英文,我们来初始化管理员root的密码
[root@localhost ~]# /usr/local/mysql/bin/mysqladmin -u root password 'yourpassword'
此处yourpassword设置为 manager
?
?
众所周知,mysql有两种帐号类型,即localhost和%,前者限本机连接mysql,后者可用于其它机器远程连接mysql
最后,处理帐号登录问题,让root帐号密码可以本地和远程连接使用
[root@localhost ~]# /usr/local/mysql/bin/mysql -u root -p #敲入该命令后,屏幕会提示输入密码,输入上一步设置的yourpassword
删除root密码为空的记录
mysql> use mysql;
mysql> delete from user where password='';
mysql> flush privileges;
配置mysql允许root远程登录 #登录
mysql> grant all privileges on *.* to root@'%' identified by "manager";
mysql> flush privileges;
mysql> select User,Password,Host from user;
?
上述命令如果执行成功
?
mysql> quit
?
?
至此,mysql安装已经全部结束.
?