jhczz@vaio:~/work/MySQL$ sudo apt-get install mysql-server
[sudo] password for jhczz:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
chromium-codecs-ffmpeg-extra linux-headers-4.8.0-36
linux-headers-4.8.0-36-generic linux-image-4.8.0-36-generic
linux-image-extra-4.8.0-36-generic snap-confine
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libaio1 libhtml-template-perl mysql-client-5.7 mysql-client-core-5.7
mysql-common mysql-server-5.7 mysql-server-core-5.7
Suggested packages:
libipc-sharedcache-perl mailx tinyca
The following NEW packages will be installed:
libaio1 libhtml-template-perl mysql-client-5.7 mysql-client-core-5.7
mysql-common mysql-server mysql-server-5.7 mysql-server-core-5.7
0 upgraded, 8 newly installed, 0 to remove and 16 not upgraded.
Need to get 17.8 MB of archives.
After this operation, 161 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://hk.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-common all 5.7.19-0ubuntu0.16.04.1 [15.7 kB]
Get:2 http://hk.archive.ubuntu.com/ubuntu xenial/main amd64 libaio1 amd64 0.3.110-2 [6,356 B]
Get:3 http://hk.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-client-core-5.7 amd64 5.7.19-0ubuntu0.16.04.1 [6,020 kB]
Get:4 http://hk.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-client-5.7 amd64 5.7.19-0ubuntu0.16.04.1 [1,654 kB]
Get:5 http://hk.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-server-core-5.7 amd64 5.7.19-0ubuntu0.16.04.1 [7,588 kB]
Get:6 http://hk.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-server-5.7 amd64 5.7.19-0ubuntu0.16.04.1 [2,463 kB]
Get:7 http://hk.archive.ubuntu.com/ubuntu xenial/main amd64 libhtml-template-perl all 2.95-2 [60.4 kB]
Get:8 http://hk.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-server all 5.7.19-0ubuntu0.16.04.1 [10.8 kB]
Fetched 17.8 MB in 14s (1,224 kB/s)
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 247417 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.7.19-0ubuntu0.16.04.1_all.deb ...
Unpacking mysql-common (5.7.19-0ubuntu0.16.04.1) ...
Selecting previously unselected package libaio1:amd64.
Preparing to unpack .../libaio1_0.3.110-2_amd64.deb ...
Unpacking libaio1:amd64 (0.3.110-2) ...
Selecting previously unselected package mysql-client-core-5.7.
Preparing to unpack .../mysql-client-core-5.7_5.7.19-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-client-core-5.7 (5.7.19-0ubuntu0.16.04.1) ...
Selecting previously unselected package mysql-client-5.7.
Preparing to unpack .../mysql-client-5.7_5.7.19-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-client-5.7 (5.7.19-0ubuntu0.16.04.1) ...
Selecting previously unselected package mysql-server-core-5.7.
Preparing to unpack .../mysql-server-core-5.7_5.7.19-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-server-core-5.7 (5.7.19-0ubuntu0.16.04.1) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up mysql-common (5.7.19-0ubuntu0.16.04.1) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Selecting previously unselected package mysql-server-5.7.
(Reading database ... 247580 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.7_5.7.19-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-server-5.7 (5.7.19-0ubuntu0.16.04.1) ...
Selecting previously unselected package libhtml-template-perl.
Preparing to unpack .../libhtml-template-perl_2.95-2_all.deb ...
Unpacking libhtml-template-perl (2.95-2) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.7.19-0ubuntu0.16.04.1_all.deb ...
Unpacking mysql-server (5.7.19-0ubuntu0.16.04.1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for ureadahead (0.100.0-19) ...
ureadahead will be reprofiled on next reboot
Processing triggers for systemd (229-4ubuntu19) ...
Setting up libaio1:amd64 (0.3.110-2) ...
Setting up mysql-client-core-5.7 (5.7.19-0ubuntu0.16.04.1) ...
Setting up mysql-client-5.7 (5.7.19-0ubuntu0.16.04.1) ...
Setting up mysql-server-core-5.7 (5.7.19-0ubuntu0.16.04.1) ...
Setting up mysql-server-5.7 (5.7.19-0ubuntu0.16.04.1) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
Setting up libhtml-template-perl (2.95-2) ...
Setting up mysql-server (5.7.19-0ubuntu0.16.04.1) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for systemd (229-4ubuntu19) ...
Processing triggers for ureadahead (0.100.0-19) ...
jhczz@vaio:~/work/MySQL$ ll
total 8
drwxrwxr-x 2 jhczz jhczz 4096 Sep 12 11:35 ./
drwxrwxr-x 9 jhczz jhczz 4096 Sep 12 11:35 ../
jhczz@vaio:~/work/MySQL$ ps -aux|grep mysql
mysql 12775 0.4 3.4 1246820 139868 ? Ssl 11:41 0:00 /usr/sbin/mysqld
jhczz 12873 0.0 0.0 14224 1076 pts/20 S+ 11:42 0:00 grep --color=auto mysql
jhczz@vaio:~/work/MySQL$ netstat -nlt|grep 3306
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
jhczz@vaio:~/work/MySQL$ sudo /etc/init.d/mysql status
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2017-09-12 11:41:39 HKT; 1min 34s ago
Main PID: 12775 (mysqld)
CGroup: /system.slice/mysql.service
└─12775 /usr/sbin/mysqld
Sep 12 11:41:37 vaio systemd[1]: Starting MySQL Community Server...
Sep 12 11:41:39 vaio systemd[1]: Started MySQL Community Server.
jhczz@vaio:~/work/MySQL$ service mysql status
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2017-09-12 11:41:39 HKT; 1min 48s ago
Main PID: 12775 (mysqld)
CGroup: /system.slice/mysql.service
└─12775 /usr/sbin/mysqld
Sep 12 11:41:37 vaio systemd[1]: Starting MySQL Community Server...
Sep 12 11:41:39 vaio systemd[1]: Started MySQL Community Server.
jhczz@vaio:~/work/MySQL$ mysql
ERROR 1045 (28000): Access denied for user 'jhczz'@'localhost' (using password: NO)
jhczz@vaio:~/work/MySQL$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.19-0ubuntu0.16.04.1 (Ubuntu)
Copyright (c) 2000, 2017, 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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.07 sec)
mysql> use information_schema
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+---------------------------------------+
| Tables_in_information_schema |
+---------------------------------------+
| CHARACTER_SETS |
| COLLATIONS |
| COLLATION_CHARACTER_SET_APPLICABILITY |
| COLUMNS |
| COLUMN_PRIVILEGES |
| ENGINES |
| EVENTS |
| FILES |
| GLOBAL_STATUS |
| GLOBAL_VARIABLES |
| KEY_COLUMN_USAGE |
| OPTIMIZER_TRACE |
| PARAMETERS |
| PARTITIONS |
| PLUGINS |
| PROCESSLIST |
| PROFILING |
| REFERENTIAL_CONSTRAINTS |
| ROUTINES |
| SCHEMATA |
| SCHEMA_PRIVILEGES |
| SESSION_STATUS |
| SESSION_VARIABLES |
| STATISTICS |
| TABLES |
| TABLESPACES |
| TABLE_CONSTRAINTS |
| TABLE_PRIVILEGES |
| TRIGGERS |
| USER_PRIVILEGES |
| VIEWS |
| INNODB_LOCKS |
| INNODB_TRX |
| INNODB_SYS_DATAFILES |
| INNODB_FT_CONFIG |
| INNODB_SYS_VIRTUAL |
| INNODB_CMP |
| INNODB_FT_BEING_DELETED |
| INNODB_CMP_RESET |
| INNODB_CMP_PER_INDEX |
| INNODB_CMPMEM_RESET |
| INNODB_FT_DELETED |
| INNODB_BUFFER_PAGE_LRU |
| INNODB_LOCK_WAITS |
| INNODB_TEMP_TABLE_INFO |
| INNODB_SYS_INDEXES |
| INNODB_SYS_TABLES |
| INNODB_SYS_FIELDS |
| INNODB_CMP_PER_INDEX_RESET |
| INNODB_BUFFER_PAGE |
| INNODB_FT_DEFAULT_STOPWORD |
| INNODB_FT_INDEX_TABLE |
| INNODB_FT_INDEX_CACHE |
| INNODB_SYS_TABLESPACES |
| INNODB_METRICS |
| INNODB_SYS_FOREIGN_COLS |
| INNODB_CMPMEM |
| INNODB_BUFFER_POOL_STATS |
| INNODB_SYS_COLUMNS |
| INNODB_SYS_FOREIGN |
| INNODB_SYS_TABLESTATS |
+---------------------------------------+
61 rows in set (0.00 sec)
mysql> show variables like '%char%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.02 sec)
mysql>
Ubuntu 16.04 安装 MySQL
最新推荐文章于 2024-02-09 10:08:10 发布