1。安装步骤参照
https://www.cnblogs.com/bookwed/p/5896619.html
2.出现问题
1)缺data-dumper
A 现象
[root@localhost mysql]#./scripts/mysql_install_db --user=mysql --datadir=/usr/app/mysql/data/mysql
FATAL ERROR: please install thefollowing Perl modules before executing ./scripts/mysql_install_db:
Data::Dumper
B 处理方法
yum -y install autoconf
2)安装文件为32位,系统为64位
执行。 ./scripts/mysql_install_db--user=mysql --datadir=/usr/app/mysql/data/mysql --basedir=/usr/app/mysql
sh:/usr/app/mysql/bin/my_print_defaults: /lib/ld-linux.so.2: bad ELF interpreter:没有那个文件或目录
FATAL ERROR: Neither host'localhost.localdomain' nor 'localhost' could be looked up with
/usr/app/mysql/bin/resolveip
Please configure the 'hostname'command to return a correct
hostname.
If you want to solve this at alater stage, restart this script
with the --force option
网上查资料表明是64位系统安装32位软件会报这个错误,需要安装glbc-i686,后来意识到为安装文件有问题,重新下载安装包
3.安装成功提示
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for yoursystem
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL rootUSER !
To do so, start the server, then issue the followingcommands:
./bin/mysqladmin -u root password'new-password'
./bin/mysqladmin -u root -hlocalhost.localdomain password 'new-password'
Alternatively you can run:
./bin/mysql_secure_installation
which will also give you the option of removing thetest
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 . ; ./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems at http://bugs.mysql.com/
The latest information about MySQL is available on theweb at
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as ./my.cnf and
will be used by default by the server when you startit.
You may edit this file to change server settings
WARNING: Default config file /etc/my.cnf exists on thesystem
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, oruse the
--defaults-file argument to mysqld_safe when startingthe server
4.修改root密码
方法1: 用SET PASSWORD命令
首先登录MySQL。
格式:mysql>set password for 用户名@localhost = password('新密码');
例子:mysql>set password for root@localhost = password('123');
方法2:用mysqladmin
格式:mysqladmin-u用户名 -p旧密码 password 新密码
例子:mysqladmin-uroot -p123456 password 123
方法3:用UPDATE直接编辑user表
首先登录MySQL。
mysql>use mysql;
mysql>update user set password=password('123') where user='root' andhost='localhost';
mysql>flush privileges;