首页 > 代码库 > centos7.2_x64安装mysql.tar.gz

centos7.2_x64安装mysql.tar.gz

1.解压 tar mysql-5.6.17-linux-glibc2.5-i686.tar.gz

2.把解压好的文件移动到/usr/local/mysql 下 cp -r mysql-5.6.17-linux-glibc2.5-i686 /usr/local/mysql

3.添加系统mysql组和mysql用户:执行命令:groupadd mysql和useradd -r -g mysql mysql

4.安装数据库:

1).修改当前目录拥有者为mysql用户:执行命令 chown -R mysql:mysql ./

2).安装数据库:执行命令 ./scripts/mysql_install_db --user=mysql

可能出现的问题:

-bash: ./scripts/mysql_install_db: /usr/bin/perl: bad interpreter: No such file or directory
提示注释器错误,没有/usr/bin/perl文件或者档案,解决办法(安装perl跟perl-devel即可):执行  yum -y install perl perl-devel

Can‘t locate Data/Dumper.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/l
ib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./scripts/mysql_install_db line 42. 

解决办法:yum -y install autoconf

3)修改当前目录拥有者为root用户:执行命令 chown -R root:root ./

4)修改当前data目录拥有者为mysql用户:执行命令 chown -R mysql:mysql data

到此数据库安装完毕

Starting MySQL...The server quit without updating PID file (/usr/local/mysql/data/localhost.localdomain.pid).

 

2 原因

 

没有初始化权限表

 

 

 

3 解决办法

 

#cd /usr/local/mysql(进入mysql安装目录)
#chown -R mysql.mysql .
#su - mysql
$cd server
$scripts/mysql_install_db

 

 

 

4 本人解决过程

 

[root@localhost ~]# cd /usr/local/mysql

 

[root@localhost mysql]# chown -R mysql.mysql .
[root@localhost mysql]# su - mysql
[mysql@localhost ~]$ cd /usr/local/mysql
[mysql@localhost mysql]$ scripts/mysql_install_db
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:

 

./bin/mysqladmin -u root password ‘new-password‘
./bin/mysqladmin -u root -h localhost.localdomain password ‘new-password‘

 

Alternatively you can run:
./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 . ; ./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 with the ./bin/mysqlbug script!

 

[mysql@localhost mysql]$ /usr/local/mysql/bin/mysqld_safe --user=mysql &
[1] 11767
[mysql@localhost mysql]$ 120502 07:01:17 mysqld_safe Logging to ‘/usr/local/mysql/data/localhost.localdomain.err‘.
120502 07:01:17 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
[mysql@localhost mysql]$ /etc/rc.d/init.d/mysql status
MySQL running (11830)                                      [  OK  ]
[mysql@localhost mysql]$ /etc/rc.d/init.d/mysql start
Starting MySQL                                             [  OK  ]

 

 

 从任何主机上使用root用户,密码:youpassword(你的root密码)连接到mysql服务器:

# mysql -u root -proot 
mysql>GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘youpassword‘ WITH GRANT OPTION;

操作完后切记执行以下命令刷新权限 

FLUSH PRIVILEGES

 

centos7.2_x64安装mysql.tar.gz