Enter net start mysql prompt in cmd: Service name is invalid or mysql is starting mysql unable to start

The error is shown in the figure:

Share pictures

The reason for the error is:Because of net start + service name, the service registered under win is started . At this time, mysql is not registered to the service in the system. That is, there is no mysql service in the current path.

Solution: 1. Go to the MySQL installation path bin

2. Enter mysqld –install in the command line (success: Service successfully install means you have successfully installed it)

Share a picture

If it is unsuccessful and Install/Remove of the Service Denied! appears, you need to run the DOS window as an administrator, so that you can succeed

Share a picture

3. Execute net start mysql and appear:

share pictures

Delete dat under mysql a file, re-execute mysqld –initialize (initialize the data file) to generate the data folder in the current path, and then execute net start mysql to start mysql

 Sharing pictures

Application examples: Python uses pymysql to link mysql database

import pymysql

import sys
try:
conn
=pymysql.connect(host='localhost ',user='root ',passwd='',db='test1',port=3306 ,charset='utf8' )
except:
print('Error opening database connection, please check')
conn.close()
sys.exit()
cur
=conn.cursor()
sql
='create table if not exists T_fish ( ' ' date1 char(12) not null,' 'name char(12) not null,' 'nums int not null,' span>'price int not null,' 'sExplain varchar(200) );
try:
cur.execute(sql)
conn.commit()
print('The table can be used')
except:
print('An error occurred during table creation')
conn.close()

When running the program, first implement the database in the mysql command line window (test1 ) Creation:

create database test1;

share picture

specific mysql database usage method address: https://www.360kuai.com/pc/93bf1e5f5201b0635?cota=4&tj_url=xz&sign=360_57c3bbd1&refer_scene=so_1

This article reference link: https://blog.csdn.net/ermaner666/article/details/79096939

import pymysql

import sys
try:
conn
=pymysql.connect(host='localhost ',user='root ',passwd='',db='test1',port=3306 ,charset='utf8' )
except:
print('Error opening database connection, please check')
conn.close()
sys.exit()
cur
=conn.cursor()
sql
='create table if not exists T_fish ( ' ' date1 char(12) not null,' 'name char(12) not null,' 'nums int not null,' span>'price int not null,' 'sExplain varchar(200) );
try:
cur.execute(sql)
conn.commit()
print('The table can be used')
except:
print('An error occurred during table creation')
conn.close()

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 256 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.