centos7.2_x64安装mysql.tar.gz
Posted 向之礼
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 本人解决过程
[[email protected] ~]# cd /usr/local/mysql
[[email protected] mysql]# chown -R
mysql.mysql .
[[email protected] mysql]# su - mysql
[[email protected] ~]$ cd /usr/local/mysql
[[email protected] 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!
[[email protected] mysql]$ /usr/local/mysql/bin/mysqld_safe --user=mysql
&
[1] 11767
[[email protected] 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
[[email protected] mysql]$ /etc/rc.d/init.d/mysql status
MySQL running
(11830)
[ OK ]
[[email protected] 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的主要内容,如果未能解决你的问题,请参考以下文章