LAMP环境官方最新源码编译安装(5)

##“-–initialize”会生成一个随机密码(~/.mysql_secret),而”–initialize-insecure”不会生成密码 ##user表示指定用户 ##basedir表示mysql的安装路径,# datadir表示数据库文件存放路径

[root@server1 ~]# mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/mysql_date/mydata/

启动MySQL数据库

[root@server1 ~]# mysqld_safe –user=mysql –datadir=/mysql_date/mydata/ ## datadir指定数据目录
[root@server1 ~]# service mysqld start
Starting MySQL [ OK ]

查看MySQL服务的进程和端口

[root@server1 ~]# ps -ef | grep mysqld root 31618 1 0 16:22 pts/1 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/mysql_date/mydata --pid-file=/mysql_date/mydata/server1.pid mysql 32370 31618 0 16:22 pts/1 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/mysql_date/mydata --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/mysql_date/mydata/mysql-error.log --open-files-limit=65535 --pid-file=/mysql_date/mydata/server1.pid --socket=/tmp/mysql.sock --port=3306 root 34026 29191 1 16:59 pts/1 00:00:00 grep mysqld [root@server1 ~]# netstat -an | grep 3306 tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN

初始化MySQL数据库的root用户密码

[root@typecodes mysql]# mysql_secure_installation ............省略前面的过程............ Press y|Y for Yes, any other key for No: y #需要修改密码,所以输入y There are three levels of password validation policy: LOW Length >= 8 #只需要长度大于或等于8】 MEDIUM Length >= 8, numeric, mixed case, and special characters #还需要包含数字、大小写和类似于@#%等特殊字符 STRONG Length >= 8, numeric, mixed case, special characters and dictionary file #还需要包含字典文件 ............省略剩下的过程............

将MySQL数据库的动态链接库共享至系统链接库

[root@server1 ~]# vim /etc/ld.so.conf.d/mysql.conf /usr/local/mysql/lib [root@server1 ~]# ldconfig -v # 让系统重新读取库文件

测试登陆MySQL数据库

[root@server1 ~]# mysql -u root -p Enter password: # 输入之前设置的密码 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.12-log Source distribution Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> 编译安装PHP前预准备

如果想让编译的php支持mcrypt扩展,还需要下载的php扩展包(mcrypt-2.6.8.tar.gz、libmcrypt-2.5.8.tar.gz、mhash-0.9.9.9.tar.gz)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/76f2dbdb99eec3168f764c6ef144ac85.html