sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-5.5 mysql-client-core-5.5
sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt-get autoremove
sudo apt-get autoclean
How to install- install the latest version:
- sudo apt-get update
- sudo apt-get install mysql-server
- then configure the MySQL:
- mysql --version
You'll see some output like this:
Output
mysql Ver 14.14 Distrib 5.7.17, for Linux (x86_64) using EditLine wrapper
If you're using version 5.7.6 or later, you should usemysqld --initializeinstead.
However, if you installed version 5.7 from the Debian distribution, like in step one, the data directory was initialized automatically, so you don't have to do anything.
Regardless of how you installed it, MySQL should have started running automatically. To test this, check its status.
- service mysql status
You'll see the following output (with a different PID).
Output
mysql start/running, process 2689
If MySQL isn't running, you can start it with sudo service mysql start.For an additional check, you can try connecting to the database using the
mysqladmin tool, which is a client that lets you run administrative commands. For example, this command says to connect to MySQL as root (-u root), prompt for a password (-p), and return the version.
- mysqladmin -p -u root version
You should see output similar to this:
Output
mysqladmin Ver 8.42 Distrib 5.5.47, for debian-linux-gnu on x86_64
Copyright (c) 2000, 2015, 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.
Server version 5.5.47-0ubuntu0.14.04.1
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/run/mysqld/mysqld.sock
Uptime: 4 min 15 sec
Threads: 1 Questions: 602 Slow queries: 0 Opens: 189 Flush tables: 1
Open tables: 41 Queries per second avg: 2.360
This means MySQL is up and running.
You can edit the /etc/mysql/my.cnf file to configure the basic
settings -- log file, port number, etc. For example, to configure MySQL
to listen for connections from network hosts, change the bind-address directive
to the server's IP address:
bind-address = 192.168.0.5
Replace 192.168.0.5 with the appropriate address.
After making a change to /etc/mysql/mysql.conf.d/mysqld.cnf the MySQL
daemon will need to be restarted:
sudo systemctl restart mysql.service
If you would like to change the MySQL root password,
in a terminal enter:
sudo dpkg-reconfigure mysql-server-5.5
The MySQL daemon will be stopped, and you will be prompted to enter a new password.
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
No comments:
Post a Comment