install mysql

Ubuntu install mysql online:
1.sudo apt-get update


2.sudo apt-get install mysql-server mysql-client


3.mysql -u root -p


allow root to log in remotely
1) From all hosts: grant all privileges on *.* to root@"%" identified by "passw0rd" with grant option;






Windows or Linux installation and first use of mysql:
1. Install MySQL (Linux)
1 You need to install perl first (if the connection to foreign networks is not smooth, you need to modify /etc The relevant path in /yum.repos.d/CentOS-Base.repo is the relevant domestic server path or the server path built by yourself), execute:
yum install perl


2 and then execute rpm -ivh MySQL-server-5.6.21- 1. el6.i686.rpm install the server, if a conflict related to mysql-libs is reported, execute yum remove mysql-libs to delete mysql-libs and then install the server.


3 Then execute rpm -ivh MySQL-client-5.6.21 -1.el6.i686.rpm to install the client


Note :
(I) For the first installation, after installation, if you cannot connect to the mysql console with the mysql command, you need to
a), stop the service
b), in /usr/my. Append after [mysqld] in the cnf file
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-grant-tables
save.
c), start the service
d),
#mysql #use mysql;
#update user set password=password('new-password') where user='root';
#exit;
e), undo the changes in step b), and then restart Serve.


(II) After successfully logging in to MySQL, if you execute any SQL command, it will prompt ERROR 1820 (HY000): You must SET PASSWORD before executing this statements.
You need to execute mysql> SET PASSWORD=PASSWORD('123456'); and then execute other Order.




2. Use mysql(Windows) after decompressing mysql.
1. After decompressing,


2. Set the environment variable
Set the environment variable path, add C:\mysql-5.7.11-winx64\bin to the path


3. Register mysql as a windows service ( When uninstalling mysqld remove)
mysqld install


4. Note: After the 5.7.x series version of mysql executes step 3, execute mysqld --initialize-insecure (here is to set a user without a password, and a password must be set after connecting to mysql)


5. Start the MySQL service: net start mysql; stop is stop


6. Log in to MySQL:
execute mysql -hlocalhost -uroot to log in to mysql.
mysql>use mysql;
mysql>set password=password('123456');
mysql>quit;


7. Log in again and
execute mysql -uroot - After
entering the password, the login is successful

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325523266&siteId=291194637