#fdisk -l
Disk /dev/vda: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000f3770
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 19920511 9959232 83 Linux
/dev/vda2 19920512 20969087 524288 82 Linux swap / Solaris
3、尝试能否通过新建分区解决的时候,发现了另一个bug,居然能看到主机的真实磁盘大小!
#fdisk /dev/vda
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): u
Changing display/entry units to cylinders (DEPRECATED!).
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
Partition number (3,4, default 3): 3
First cylinder (1306-20805, default 1306):
Using default value 1306
Last cylinder, +cylinders or +size{K,M,G} (1306-20805, default 20805):
Using default value 20805
Partition 3 of type Linux and of size 149.4 GiB is set
//剩余149.4G,加上我自己的10G,这块SSD的大小应该是160G的,当然仅此而已了,想要盗用还是不可能的,至少我办不到。囧
Command (m for help): q
fdisk -l
//虽然fdisk看到的vda3貌似很厉害的样子
Disk /dev/vda: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000f3770
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 19920511 9959232 83 Linux
/dev/vda2 19920512 20969087 524288 82 Linux swap / Solaris
/dev/vda3 20969088 334232324 156631618+ 83 Linux
4、partprobe的时候果然报错了哈哈哈
#partprobe
Error: Can't have a partition outside the disk!
#resize2fs /dev/vda1 (其实核心就是这个命令) resize2fs 1.42.9 (28-Dec-2013) Filesystem at /dev/vda1 is mounted on /; on-line resizing required old_desc_blocks = 1, new_desc_blocks = 2 The filesystem on /dev/vda1 is now 2489808 blocks long.
[root@nmserver-7 ~]# systemctl enable httpd Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
1.4 查看服务状态
[root@nmserver-7 ~]# systemctl status httpd ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Active: active (running) since 五 2017-07-21 17:21:37 CST; 6min ago Docs: man:httpd(8) man:apachectl(8) Main PID: 2449 (httpd) Status: "Total requests: 11; Current requests/sec: 0; Current traffic: 0 B/sec" CGroup: /system.slice/httpd.service ├─2449 /usr/sbin/httpd -DFOREGROUND ├─2450 /usr/sbin/httpd -DFOREGROUND ├─2451 /usr/sbin/httpd -DFOREGROUND ├─2452 /usr/sbin/httpd -DFOREGROUND ├─2453 /usr/sbin/httpd -DFOREGROUND ├─2454 /usr/sbin/httpd -DFOREGROUND ├─2493 /usr/sbin/httpd -DFOREGROUND ├─2494 /usr/sbin/httpd -DFOREGROUND └─2495 /usr/sbin/httpd -DFOREGROUND 7月 21 17:21:35 nmserver-7.test.com systemd[1]: Starting The Apache HTTP Server... 7月 21 17:21:36 nmserver-7.test.com httpd[2449]: AH00558: httpd: Could not reliably determine the server's fully q...ssage 7月 21 17:21:37 nmserver-7.test.com systemd[1]: Started The Apache HTTP Server. Hint: Some lines were ellipsized, use -l to show in full.
[root@nmserver-7 ~]# netstat -tulp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN 1084/sshd tcp 0 0 0.0.0.0:mysql 0.0.0.0:* LISTEN 9760/mysqld tcp6 0 0 [::]:ssh [::]:* LISTEN 1084/sshd tcp6 0 0 [::]:http [::]:* LISTEN 2449/httpd udp 0 0 localhost:323 0.0.0.0:* 592/chronyd udp6 0 0 localhost:323 [::]:* 592/chronyd
2.3 数据库安全设置
[root@nmserver-7 ~]# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n] y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] n ... skipping. By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
2.4 登陆数据库测试
[root@nmserver-7 ~]# mysql -uroot -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 11 Server version: 5.5.52-MariaDB MariaDB Server Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | +--------------------+ 3 rows in set (0.02 sec) MariaDB [(none)]>
安装cmake:
yum install cmake
或源码安装:
wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz
tar -xzvf cmake-2.8.10.2.tar.gz
cd cmake-2.8.10.2
./bootstrap ; make ; make install
cd ~
新增mysql用户组:
groupadd mysql
新增mysql用户:
useradd -r -g mysql mysql
新建mysql安装目录:
mkdir -p /usr/local/mysql
新建mysql数据库数据文件目录:
mkdir -p /data/mysqldb
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.34.tar.gz
tar -zxvf mysql-5.6.34.tar.gz
cd mysql-5.6.34
MySQL问题解决:-bash:mysql:command not found
因为mysql命令的路径在/usr/local/mysql/bin下面,所以你直接使用mysql命令时,
系统在/usr/bin下面查此命令,所以找不到了
解决办法是:
ln -s /usr/local/mysql/bin/mysql /usr/bin 做个链接即可
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/usr/local/mysql/mysql.sock’ (2)
1、先查看 /etc/rc.d/init.d/mysqld status 看看mysql服务是否已经启动.
另外看看是不是权限问题.
$service mysqld start
或
$service mysql start
–我开始遇到的就是因为服务没启动,因为第一次玩mysql不是很熟悉,呵呵。
2、确定你的mysql.sock是不是在那个位置,
mysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock